Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Jan 15, 2018

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

Lift the left hand side of a right-associative infix operation
only if the operation takes a by-value argument.
@odersky
Copy link
Contributor Author

odersky commented Feb 3, 2018

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(
Copy link
Member

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) =>
Copy link
Member

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?

Copy link
Contributor Author

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.

@smarter smarter assigned odersky and unassigned smarter Feb 3, 2018
And add a comment on possibly ode types returned from typedApply
@odersky odersky merged commit d2d7d99 into scala:master Feb 3, 2018
@allanrenucci allanrenucci deleted the fix-#2808 branch February 5, 2018 06:36
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
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.

2 participants