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

SI-8417 Check adapts of each param section #5643

Merged
merged 1 commit into from Mar 22, 2017

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Jan 16, 2017

Previously, adaptations like auto-tupling were checked
only on the last param section of an application.

This commit runs the sanity check always.

JIRA: https://issues.scala-lang.org/browse/SI-8417

@scala-jenkins scala-jenkins added this to the 2.12.2 milestone Jan 16, 2017
@adriaanm adriaanm self-requested a review February 16, 2017 20:33
|| checkValidAdaptation(t, args)
)
// May warn or error here if a Unit or tuple was inserted.
def validate(t: Tree): Tree = {
Copy link
Contributor

Choose a reason for hiding this comment

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

This goes in the right direction in making the check more explicit. Can we push it a bit more and avoid future reorderings of the conditions?

// May warn or error if a Unit or tuple was inserted.
def validate(t: Tree): Tree = {
  val invalidAdaptation = t.symbol != null && !checkValidAdaptation(t, args) // regardless of typer's mode
  if (invalidAdaptation && mode.typingExprNotFun) EmptyTree // only bail if we're typing an expression (and not inside another application)
  else t
}

Previously, adaptations like auto-tupling were checked
only on the last param section of an application.

This commit runs the sanity check always.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants