Skip to content
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

Don't eta expand unary varargs methods #16892

Merged
merged 1 commit into from
Feb 19, 2023
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented 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 #16820

Reclassifies #14567 to be a neg test (with the error message suggested in the original issue for #14567)

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)
@anatoliykmetyuk anatoliykmetyuk added this pull request to the merge queue Feb 15, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 15, 2023
@odersky odersky merged commit 3e18fee into scala:main Feb 19, 2023
@odersky odersky deleted the fix-16820 branch February 19, 2023 22:11
@Kordyjan Kordyjan added this to the 3.3.1 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling java functions without parentheses results in lambdas instead of compilation errors
3 participants