-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #2808: Modify lifting of infix operations #3841
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
Conversation
733a40b
to
7e8ce02
Compare
Lift the left hand side of a right-associative infix operation only if the operation takes a by-value argument.
Also, more tests
Rebased to master so that fixes in #3918 apply. |
} else { | ||
val x = UniqueName.fresh() | ||
val selectPos = Position(op.pos.start, right.pos.end, op.pos.start) | ||
new InfixOpBlock( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InfixOpBlock is no longer used and could be removed.
case Apply(fn, args) => | ||
if (app.tpe.isError) app | ||
else tpd.cpy.Apply(app)(fn, LiftImpure.liftArgs(defs, fn.tpe, args)) | ||
case Assign(lhs, rhs) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app
is always an Apply
node so I don't see how we can fall into this case or the next?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, typedApply
can also produce an Assign
node, namely if the application is an operator assignment. E.g.
x.+=(y)
gives
x = x.+(y)
I added a comment to typedApply pointing this out.
And add a comment on possibly ode types returned from typedApply
Implemented in Scala 2.13 in scala/scala#5969 Implemented in Scala 3 in scala/scala3#3841
Implemented in Scala 2.13 in scala/scala#5969 Implemented in Scala 3 in scala/scala3#3841
Lift the left hand side of a right-associative infix operation
only if the operation takes a by-value argument.
Implements SIP 34.
Based on #3839