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

Unexpected eta expansion is behind -Xsource-features:eta-expand-always #10907

Open
wants to merge 1 commit into
base: 2.13.x
Choose a base branch
from

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Oct 30, 2024

Require -Xsource-features:eta-expand-always for eta-expansion without an expected type.

Plain -Xsource:3 is reserved for benign features only.

As a consequence, -Xsource-features:case-companion-function requires -Xsource-features:eta-expand-always.

Fixes scala/bug#13055

@scala-jenkins scala-jenkins added this to the 2.13.16 milestone Oct 30, 2024
@som-snytt som-snytt added the release-notes worth highlighting in next release notes label Oct 30, 2024
@som-snytt
Copy link
Contributor Author

som-snytt commented Oct 30, 2024

This requires specifying -Xsource-features:case-companion-function,eta-expand-always together.

It's not desirable to automatically turn on eta-expand because of innocent case-companion-function.

Should there be a migration warning under -Xsource:3? Does every source-feature emit a migration warning?

@som-snytt som-snytt requested a review from lrytz October 30, 2024 21:53
@som-snytt som-snytt marked this pull request as ready for review October 30, 2024 21:53
@som-snytt
Copy link
Contributor Author

Do I remember that rebuild request does not restart Travis?

@som-snytt
Copy link
Contributor Author

Rebased for rebuild.

@lrytz
Copy link
Member

lrytz commented Nov 12, 2024

Should there be a migration warning under -Xsource:3?

It's a special case as the migration message would show up in the MissingArgsForMethodTpeError message. Code that compiles on 2.13 will compile the same with -Xsource:3 and on Scala 3, so no warning can show up.

We could still add it here, no?

          val mm = if (scala3) ", or in Scala 3 or with -Xsource-features..." else ""
          else s"""
            |Unapplied methods are only converted to functions when a function type is expected${mm}.
            |You can make this conversion explicit by writing `$f _` or `$paf` instead of `$f`.""".stripMargin

@SethTisue SethTisue modified the milestones: 2.13.16, 2.13.17 Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scalacheck Prop.forAll with > 8 arbitraries eta-expands under -Xsource:3
4 participants