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

under -source:future, don't warn on infix usage of Scala 2 defined methods with default arguments #13714

Merged
merged 1 commit into from Oct 14, 2021

Conversation

SethTisue
Copy link
Member

@SethTisue SethTisue commented Oct 7, 2021

fixes #10383

this is WIPpy at the moment, but plausible, and we wanted to get CI feedback over the weekend :-)

@dwijnand
Copy link
Member

dwijnand commented Oct 7, 2021

Looks like Apply is a ProxyTree, so it delegates its denotation to the underlying function, while Block isn't, so its denotation is NoDenotation - which doesn't have Scala2x...

So another way, or perhaps in addition, would be to verify the symbol exists before deciding whether the method is Scala 2 or not. Or assert it exists.

fixes scala#10383

Co-authored-by: Dale Wijnand <dale.wijnand@gmail.com>
@SethTisue
Copy link
Member Author

SethTisue commented Oct 13, 2021

Aside:

We also tried making Block forward its denot method to expr and that did fix the bug without having to change Typer, and in testCompilation only three failures ensued. And we tried going even a little farther and making Block actually extend ProxyTree and there were also only a handful of failures (nearly the same set).

We looked at those failures for a while out of curiosity, but in the end, changing Block in either of those ways would be a pretty fundamental change, and even if the test failures are surely fixable, it seems like too ambitious a change in the context of this bug.

If any reviewer happens to know why a Block isn't a ProxyTree, we're all ears — the low number of test failures when we make it one seems to indicate that it plausibly could be.

@SethTisue
Copy link
Member Author

So another way, or perhaps in addition, would be to verify the symbol exists before deciding whether the method is Scala 2 or not. Or assert it exists.

(We chose not to go this route for fear of false negatives.)

@SethTisue SethTisue marked this pull request as ready for review October 13, 2021 17:45
@SethTisue SethTisue changed the title don't warn on infix usage of Scala 2 defined methods don't warn on infix usage of Scala 2 defined methods with default arguments Oct 13, 2021
@SethTisue SethTisue changed the title don't warn on infix usage of Scala 2 defined methods with default arguments under -source:future, don't warn on infix usage of Scala 2 defined methods with default arguments Oct 13, 2021
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (btw, once a PR is ready to review, you can assign a reviewer yourself so it doesn't get lost).

@smarter smarter merged commit 583a5e5 into scala:master Oct 14, 2021
@SethTisue SethTisue deleted the issue-10383 branch October 14, 2021 13:15
@Kordyjan Kordyjan added this to the 3.1.1 milestone Aug 2, 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.

BigInt(1) to BigInt(3) gives infix warning under -source:3.1
4 participants