-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Calling java functions without parentheses results in lambdas instead of compilation errors #16820
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
This is due to improvement #14397
versus
Also in 2.13, "empty application" does not apply to varargs:
|
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 12, 2023
A unary varargs method sits between nullary methods that sometimes get a () argument inferred (i.e. for methods coming from Java) and other methods that can be eta expanded. The safest strategy for them is to do neither, and expect either an explicit expected function type, or an explicit argument. That's also what Scala 2 does. Fixes scala#16820 Reclassifies scala#14567 to be a neg test (with the error message suggested in the original issue for scala#14567)
odersky
added a commit
that referenced
this issue
Feb 19, 2023
A unary varargs method sits between nullary methods that sometimes get a () argument inferred (i.e. for methods coming from Java) and other methods that can be eta expanded. The safest strategy for them is to do neither, and expect either an explicit expected function type, or an explicit argument. That's also what Scala 2 does. Fixes #16820 Reclassifies #14567 to be a neg test (with the error message suggested in the original issue for #14567)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.1.3 and later
Minimized code
Output
Expectation
Compilation error (like before) or file path (like what I want). Calling java functions without parentheses was my good habit that suddenly turned out to be bad one.
The text was updated successfully, but these errors were encountered: