-
Notifications
You must be signed in to change notification settings - Fork 1.1k
unsafeNulls import doesn't work properly for java methods with generic return type #18775
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
These errors are expected according to rules of
One workaround is to define the type parameter as |
With a new definition of untyped trees, it is now required to have `-Yexplicit-nulls` flag in modules that use them in order to have proper type checking. This PR adds the missing flag. Without the flag, it was possible to first assign untyped trees to typed trees, and secondly use extension methods for typed trees which can be seen at `KeywordsCompletions.scala` with usage of `untpdTree.filterSubtrees`. It is also blocked by: #18775 I can also make a workaround in the unmanaged module, but it will require a dependency on nightly version / a new release from metals.
With a new definition of untyped trees, it is now required to have `-Yexplicit-nulls` flag in modules that use them in order to have proper type checking. This PR adds the missing flag. Without the flag, it was possible to first assign untyped trees to typed trees, and secondly use extension methods for typed trees which can be seen at `KeywordsCompletions.scala` with usage of `untpdTree.filterSubtrees`. It is also blocked by: #18775 I can also make a workaround in the unmanaged module, but it will require a dependency on nightly version / a new release from metals. [Cherry-picked e149e4c]
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.4.0-RC1-bin-20231024-15033c7-NIGHTLY
Java methods with generic return type fails when we return them inside anonymous functions and rely on type inference.
Minimized code
Test.scala
Test.java
And it is working for:
The origin problem was found in: https://github.com/scalameta/metals/blob/0d2739f6dfd96c455dadeca56dc85581e3bc48de/mtags-shared/src/main/scala/scala/meta/internal/mtags/CommonMtagsEnrichments.scala#L41-L60
Output
Compilation fails even with
import scala.language.unsafeNulls
Expectation
It should compile.
The text was updated successfully, but these errors were encountered: