-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Illegal signature for higher kinded type with AnyVal upper bound #5720
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
Comments
class A[B[_] <: Long] is generating the waring |
Can be replicated with |
It seems to happen for any |
@nicolasstucki Multiple such I guess your point is that you can't extend Glancing at https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-4.html#jvms-4.7.9.1 reveals that I found the responsible code and how to fix it for these cases. Thinking it through and testing a bit. scala> class A[B[_] <: Long]
// defined class A
scala> type C = A[[x] => Long]
// defined alias type C = A[[x] => Long]
scala> type C = A[[x] => Nothing]
// defined alias type C = A[[x] => Nothing] |
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.
@nicolasstucki Also, somehow this error does not fail the test in #5708 (which seems to use |
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.
@Blaisorblade move the test to |
Ah, that's because it's a normal error and we check for crashes, so I'd want |
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.
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.
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.
Fix #5720: don't output X <: Long in Java generic signatures
While testing another patch, I got this output:
Grep suggests that might be coming from https://github.com/lampepfl/scala/blob/9ef70dd9b9eeec11cfb72dabb57c61198fa18a20/src/asm/scala/tools/asm/util/CheckClassAdapter.java#L993.
Noting this for future usage, can't investigate right now...
The text was updated successfully, but these errors were encountered: