-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix a compiler assertion crash #16291
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
Conversation
fec3c71
to
3e17aa0
Compare
3e17aa0
to
4b7c7e3
Compare
@@ -2633,7 +2633,8 @@ object Types { | |||
} | |||
} | |||
if (prefix.isInstanceOf[WildcardType]) WildcardType | |||
else withPrefix(prefix) | |||
else if prefix.isValueTypeOrWildcard || (prefix eq NoPrefix) then withPrefix(prefix) | |||
else typer.ErrorReporting.errorType(i"Cannot ($this).deriveSelect($prefix)", ctx.tree) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message shows up if I change mkArray[Array]
to val x = mkArray[Array]
so a more user-friendly message would be nicer.
I was trying to see if we could catch the problem earlier but it's a bit tricky. The problem is that when the prefix is erroneous we still create dummy denotations in findMember: https://github.com/lampepfl/dotty/blob/970d1191ae61dbcc2c10f55ee749c946e35d57db/compiler/src/dotty/tools/dotc/core/Types.scala#L725-L726
If we just drop this case and return a NoDenotation then we avoid these complications, but that could maybe lose information.
Otherwise we could try to handle these error denotations better, but it's tricky because newErrorSymbol actually wraps the ErrorType in a TypeAlias when the member is a type, and Type#isError doesn't check that.
4b7c7e3
to
8ac4cf1
Compare
8ac4cf1
to
b31147c
Compare
No description provided.