Skip to content

Fix #7401: Refine overloading resolution #7989

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 4 commits into from
Jan 15, 2020
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 15, 2020

If we are left with several alternatives after normal overloadiong resolution
and the expected result type is not a FunProto, prefer the alternatives
that do not have a method result type. This makes i2378 compile, so it got
moved to a pos test.

If we are left with several alternatives after normal overloadiong resolution
and the expected result type is not a FunProto, prefer the alternatives
that do not have a method result type. This makes i2378 compile, so it got
moved to a pos test.
The error that was checked for in the test is no more.
The previous code did not compose correctly with the "no defaults" criterion
that followed.
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.

Otherwise, LGTM

// prefer alternatives that need no eta expansion
val noCurried = alts.filter(!resultIsMethod(_))
val noCurriedCount = noCurried.length
if noCurried.length == 1 then
Copy link
Contributor

Choose a reason for hiding this comment

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

As pointed out by @michelou , we can just use noCurriedCount instead of noCurried.length .

@odersky odersky merged commit 10c7668 into scala:master Jan 15, 2020
@odersky odersky deleted the fix-#7401 branch January 15, 2020 17:14
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