Skip to content

Fix #6705: Improve adaptation of overloaded terms #6955

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 2 commits into from
Aug 2, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 28, 2019

If a term is overloaded and the expected type is not an application,
prefer the parameterless alternative.

If a term is overloaded and the expected type is not an application,
prefer the parameterless alternative.
@odersky odersky requested a review from smarter July 30, 2019 15:16
case alt :: Nil => readaptSimplified(tree.withType(alt))
case _ =>
if (altDenots exists (_.info.paramInfoss == ListOfNil))
typed(untpd.Apply(untpd.TypedSplice(tree), Nil), pt, locked)
Copy link
Member

Choose a reason for hiding this comment

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

Any reason we couldn't also do readaptSimplified(tree.withType(alt)) here ?

Copy link
Contributor Author

@odersky odersky Jul 31, 2019

Choose a reason for hiding this comment

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

We add a () argument here, so the term changes.

@odersky odersky merged commit 3ae1bc8 into scala:master Aug 2, 2019
odersky added a commit that referenced this pull request Nov 17, 2022
#16315)

Fixes #10715.
Pair-programmed with @smarter this morning 😃

Parameterless alternatives were already preferred when there was no
matching alternativ (#6955).
With this PR, they are also preferred when the alternatives are
"ambiguous".
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