-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #9568: Disallow partially undefined types as byname anchors #9575
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
@@ -1371,8 +1376,12 @@ trait Implicits: | |||
history match | |||
case prev @ OpenSearch(cand1, tp, outer) => | |||
if cand1.ref eq cand.ref then | |||
def checkFullyDefined = | |||
val result = isFullyDefined(tp, ForceDegree.failBottom) |
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.
What would happen if we forced the type to be fully defined at that point instead of disqualifying it?
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.
I guess it will only be disqualified if a type variable would be instantied to Nothing, but that might be a legitimate instantiation
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.
Yes, I don't know what is the right force degree, or whether there even is one.
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.
I've tried setting the force degree to all which changes how we do error reporting but seems to be fine, let me know what you think.
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.
I think that's fine, too. It's a corner case, so the simpler the handling the better.
Require that the type that a by-name implicit can recursively implement must be fully defined.
36e0755
to
e8b94f0
Compare
Nothing has legitimate use as a type parameter, so special-casing inference to reject it can cause issues. Also by removing this special-case we can remove the error reporting logic dedicated to dealing with non-fully-defined types, instead the user will see that a type parameter was instantiated to `Nothing` in the error which should be clear enough.
Require that the type that a by-name implicit can recursively implement
must be fully defined.