Skip to content

Fix #8569: Better error message for erroneous creator applications #8584

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
Mar 22, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Mar 21, 2020

Don't just fall-back to say "not a member".

@odersky
Copy link
Contributor Author

odersky commented Mar 21, 2020

Based on #8583

Give some context why an immutable path is required, and explain
what an immutable path is.
@odersky odersky requested a review from smarter March 21, 2020 20:41
Let the class itself worry about how to display that name, and means we
can compare that name in `saysNotFound` without having to convert it to
a String.
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

Really nice errors! I've pushed an extra commit to make MissingIdent take a Name instead of a String to avoid the use of Name#toString. In #8569 I suggested we could also automatically stabilize prefixes of constructor calls to avoid the error, what's your opinion on that ?

@odersky
Copy link
Contributor Author

odersky commented Mar 22, 2020

I considered auto-stabilization, but in the end did not follow through. The problem is that you might generate a temporary variable that then gives a mysterious error message when you need to apply avoidance later. Also, it works only in some cases. I.e. works for new, but not for other types or class parents.

I believe the issue is best discussed separately. If we talk about auto-stabilization, we should also consider paths in patterns and in imports.

@odersky odersky merged commit 6089e1d into scala:master Mar 22, 2020
@odersky odersky deleted the fix-#8569 branch March 22, 2020 10:23
@liufengyun
Copy link
Contributor

liufengyun commented Mar 24, 2020

This PR caused significant performance regression.

http://dotty-bench.epfl.ch/

@odersky
Copy link
Contributor Author

odersky commented Mar 24, 2020

Wow, that's amazing. I guess it's because it's forcing error message contents to see what's in it.

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