Skip to content

Fix #9132: Align with Scala 2's handling of () infix arguments #9137

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

Merged
merged 5 commits into from
Jun 10, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 9, 2020

A right argument of an infix operation is kept as an empty tuple, instead
of being desugared to an empty parameter list.

The most involved part of the change was getting decent error messages, since
it required propagating the information that an apply is an infix all the way
into application checking. Hopefully, we can profit from the change when
we drop auto-tupling, since then similar info will be needed for error
messages in more situations.

odersky added 2 commits June 9, 2020 13:53
A right argument of an infix operation is kept as an empty tuuple, instead
of being desugared to an empty parameter list.

The most involved part of the change was getting decent error messages, since
it required propagating the information that an apply is an infix all the way
into application checking. Hopefully, we can profit from the change when
we drop auto-tupling, since then similar info will be needed for error
messages in more situations.
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

def setUsingApply() = { putAttachment(untpd.ApplyGiven, ()); this }
def setUsingApply() =
putAttachment(untpd.ApplyGiven, ())
this
Copy link
Contributor

Choose a reason for hiding this comment

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

A conceptual question: if Infix and Using are mutually exclusive, would it be better to use attachment for Infix as well to avoid creating the class InfixApply? Something like:

def setApplyKind(kind: ApplyKind) = 
  putAttachment(untpd.ApplyKind, kind)
  this

def applyKind: ApplyKind =
  attachmentOrElse(untpd.ApplyKind, ApplyKind.Regular)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think that might be better. I'll try that out.

@liufengyun liufengyun merged commit 3c56b3e into scala:master Jun 10, 2020
@liufengyun liufengyun deleted the fix-#9132 branch June 10, 2020 08:03
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.

3 participants