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

Keep qualifier of Ident when selecting setter #18714

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

nicolasstucki
Copy link
Contributor

We already keep the qualifier as a typed splice if the prefix is an explicit Select.

Fixes #18713

@nicolasstucki nicolasstucki marked this pull request as ready for review October 18, 2023 09:31
@nicolasstucki nicolasstucki force-pushed the fix-18713 branch 2 times, most recently from 5a1ed3b to c782372 Compare October 24, 2023 09:23
@@ -1119,7 +1119,13 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
case Apply(fn, _) if fn.symbol.is(ExtensionMethod) =>
def toSetter(fn: Tree): untpd.Tree = fn match
case fn @ Ident(name: TermName) =>
untpd.cpy.Ident(fn)(name.setterName)
fn.tpe match
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks non-sensical that on the one hand we can refer to a lhs with a simple ident, but on the other hand the setter needs a full tree expansion. Can you add a comment why that is so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment

We already keep the qualifier as a typed splice if the prefix is an
explicit Select.

Fixes scala#18713
compiler/src/dotty/tools/dotc/typer/Typer.scala Outdated Show resolved Hide resolved
@nicolasstucki nicolasstucki merged commit bd24735 into scala:main Nov 13, 2023
16 checks passed
@nicolasstucki nicolasstucki deleted the fix-18713 branch November 13, 2023 19:08
@Kordyjan Kordyjan added this to the 3.4.0 milestone Dec 20, 2023
WojciechMazur added a commit that referenced this pull request Jun 23, 2024
Backports #18714 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
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.

Overloaded assignment operators defined as extension methods across different objects fail to compile
3 participants