-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #5720: don't output X <: Long in Java generic signatures #5816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #5720: don't output X <: Long in Java generic signatures #5816
Conversation
944e698
to
01f16a0
Compare
This comment has been minimized.
This comment has been minimized.
Still todo: maybe move tests/fuzzy/IAE-4a69457e1319217c3bac170110ea4ba58dca11a6.scala to |
This comment has been minimized.
This comment has been minimized.
5901575
to
1fc9b1b
Compare
@biboudis Your bot keeps assigning people to PR, can you make it stop ? |
tests/pos/i5720.scala
Outdated
@@ -0,0 +1,5 @@ | |||
class A[B[_] <: Long] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also add some tests in the form of
class A[B[_] <: Foo]
class Foo(val i: Int) extends AnyVal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And with an opaque type that has a primitive type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also have tests for all primitives
class AByte[B[_] <: Byte]
...
class AInt[B[_] <: Int]
...
The fix LGTM |
@smarter looking into it! |
In generic signature generator `jsig`, flag `primitiveOK` remembers if `jsig` is allowed to output primitive types or not; for instance, upper bounds can't contain primitive types. When transforming higher-kinded upper bounds `[X] => T`, `jsig` correctly recurs on `T`, but must remember flag `primitiveOK`. The status of `toplevel` should not change either (since it tracks if are still at the toplevel of the output signature, or instead we have started producing output), so passing it seems safest. Ideally we should test it at least on higher types whose body is a suitable `ClassInfo`; with polymorphic function types, we should also test `PolyType` bodies. Revised with tests requested in review.
81a005c
to
c954ef0
Compare
Added requested tests :-)
In generic signature generator
jsig
, flagprimitiveOK
remembers ifjsig
isallowed to output primitive types or not; for instance, upper bounds can't
contain primitive types. When transforming higher-kinded upper bounds
[X] => T
,jsig
correctly recurs onT
, but must remember flagprimitiveOK
.The status of
toplevel
should not change either (since it tracks if are stillat the toplevel of the output signature, or instead we have started producing
output), so passing it seems safest. Ideally we should test it at least on
higher types whose body is a suitable
ClassInfo
; with polymorphic functiontypes, we should also test
PolyType
bodies.Fix #5720.