Skip to content

Changes to overloading #1389

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
Jul 18, 2016
Merged

Changes to overloading #1389

merged 4 commits into from
Jul 18, 2016

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 14, 2016

Fix #1381: Overloading is now changed so that we first try without implicit searches.
Only if that leaves no applicable alternatives we try again with implicit search turned on.
This also fixes test case t2660, which got moved from neg to pos.

Review by @smarter or @nicolasstucki

@smarter
Copy link
Member

smarter commented Jul 14, 2016

Is this as specified or should we make a note that we need to update the spec?

@odersky
Copy link
Contributor Author

odersky commented Jul 15, 2016

We should make a note to update the spec. I am sure there are other small details that are different as well; notably in how the expected return type is handled.

@odersky
Copy link
Contributor Author

odersky commented Jul 15, 2016

/rebuild

}
}

var found = resolveOverloaded(alts, pt, Nil)(ctx.retractMode(Mode.ImplicitsEnabled))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could avoid the var here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How would you propose to avoid it?

@nicolasstucki
Copy link
Contributor

That is all.
Otherwise LGTM.

@nicolasstucki
Copy link
Contributor

Actually you should also add a test that involves implicits in one or both functions.

odersky added 3 commits July 15, 2016 15:08
Fix scala#1381: Overloading is now changed so that we first try without implicit searches.
Only if that leaves no applicable alternatives we try again with implicit search turned on.
This also fixes test case t2660, which got moved from neg to pos.
Adds the original test form scala#1381. t2660 looks similar.
Also adds some unrelated tests I had in the queue that now
compile.
@odersky
Copy link
Contributor Author

odersky commented Jul 15, 2016

rebased to master

class C2 extends C1 {
def f(x: B): Unit = println("B")
}
object Test extends C2 with App {
Copy link
Contributor

Choose a reason for hiding this comment

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

These tests should probably be in run to check if the correct overload of f is called.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for class Foo above.

@odersky
Copy link
Contributor Author

odersky commented Jul 15, 2016

Another insufficient memory failure

/rebuild

@odersky
Copy link
Contributor Author

odersky commented Jul 16, 2016

/rebuild

@odersky
Copy link
Contributor Author

odersky commented Jul 16, 2016

We seem to have memory problems again.

@odersky
Copy link
Contributor Author

odersky commented Jul 16, 2016

@nicolasstucki Can you add the necessary tests? I won't have time to do it before leaving on my trip. Thanks!

@nicolasstucki
Copy link
Contributor

I'll add the tests on tomorrow.

@odersky
Copy link
Contributor Author

odersky commented Jul 18, 2016

@nicolsstucki Thanks for adding the tests.

@odersky odersky merged commit a307a90 into scala:master Jul 18, 2016
@allanrenucci allanrenucci deleted the fix-#1381 branch December 14, 2017 16:59
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.

Ambiguous overloads with type parameter and implicit conversion.
3 participants