Skip to content

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.

Co-Authored-By: Guillaume Martres <smarter@ubuntu.com>
@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