Fix #2808: Modify lifting of infix operations#3841
Merged
odersky merged 5 commits intoscala:masterfrom Feb 3, 2018
Merged
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
Contributor
Author
|
Rebased to master so that fixes in #3918 apply. |
smarter
approved these changes
Feb 3, 2018
| } else { | ||
| val x = UniqueName.fresh() | ||
| val selectPos = Position(op.pos.start, right.pos.end, op.pos.start) | ||
| new InfixOpBlock( |
Member
There was a problem hiding this comment.
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) => |
Member
There was a problem hiding this comment.
app is always an Apply node so I don't see how we can fall into this case or the next?
Contributor
Author
There was a problem hiding this comment.
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
2 tasks
julienrf
added a commit
to scalacenter/docs.scala-lang
that referenced
this pull request
May 3, 2022
Implemented in Scala 2.13 in scala/scala#5969 Implemented in Scala 3 in scala/scala3#3841
julienrf
added a commit
to scala/improvement-proposals
that referenced
this pull request
Jun 9, 2022
Implemented in Scala 2.13 in scala/scala#5969 Implemented in Scala 3 in scala/scala3#3841
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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