Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(#i18645): overload ext method body in braces didn't compile #19651

Conversation

i10416
Copy link
Contributor

@i10416 i10416 commented Feb 9, 2024

close #18645

related to #12941

tryWithImplicitOnQualifier returned without attempting tryInsertImplicitOnQualifier, which prevented the compiler from finding overloaded method, because hasInnerErrors in ProtoTypes picked up the inner error propagated back from outer error.

When compiling x.pprint(()=> { 123 }) before this commit, in hasInnerErrors, t contains two sub trees; Block(stmt, expr) and stmt. The span of the former matches the span of t, but that of the latter does not, which caused hasInnerErrors to return true, but the error from the latter is duplicated with the error of parent tree t.

`tryWithImplicitOnQualifier` returned without attempting `tryInsertImplicitOnQualifier`,
which prevented the compiler from finding overloaded method, because `hasInnerErrors`
in `ProtoTypes` picked up the inner error propagated back from outer error.

When compiling `x.pprint(()=> { 123 })` before this commit, in `hasInnerErrors`,
`t` contains two sub trees; `Block(stmt, expr)` and `stmt`. The span of the former matches
the span of `t`, but that of the latter does not, which caused `hasInnerErrors` to return `true`,
but the error from the latter is duplicated with the error of parent tree `t`.
@i10416
Copy link
Contributor Author

i10416 commented Feb 9, 2024

Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

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

So, I think this ends up being the right fix.

@dwijnand dwijnand merged commit 8776677 into scala:main Feb 13, 2024
19 checks passed
@Kordyjan Kordyjan added this to the 3.4.1 milestone Feb 14, 2024
WojciechMazur added a commit that referenced this pull request Jul 2, 2024
…pile" to LTS (#20916)

Backports #19651 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overloaded extension method usage does not compile if the body of its callback argument is wrapped in braces
3 participants