Skip to content

Fix #8736: Handle alternatives with same signature in overloading resolution #8822

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 3 commits into from
Apr 29, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Apr 28, 2020

Turn an assertion into an checked error with an error message
pointing to the root of the problem.

It would be nice if we managed to compile #8736, but this looks out of reach for the time being. The problem is that we generate overloaded denotations where alternatives have the same TermRef, since the different denotations have different types (method types over singleton types), yet their signature is the same since all these method types erase to the same one.

if the program was written with regular methods this would give an error saying that the different versions have the same signature after erasure. #8736 tries to cleverly get around that restriction by using structural types. But that will not work either, I am afraid. Making it work by tweaking the compiler would be extremely hard since basically all our low level infrastructure is built around signatures and erasure. This is in order to get acceptable performance in the presence of intersection types. I have no idea whether one could redesign the compiler infrastructure dropping signatures and still get acceptable performance. I doubt it, though, and won't try to do that.

odersky added 3 commits April 28, 2020 12:34
It always goes to `err`, so no need to abstract over it.
Turn an assertion into an checked error with an error message
pointing to the root of the problem.
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.

LGTM

@odersky odersky merged commit a7ef3e2 into scala:master Apr 29, 2020
@odersky odersky deleted the fix-#8736 branch April 29, 2020 07:47
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