-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Nothing
inferred when unexpected
#16323
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
Comments
I'm not sure. Is this a bug? Should |
We do have logic to avoid either uninstantiated type variables or type variables instantiated to Nothing in similar situations: https://github.com/lampepfl/dotty/pull/10205/files, so I think it's worth digging into why this doesn't trigger here. |
Maybe |
Yes, that's it. We interpolate before we have a chance to approximate by the upper bound in I think we can fix that by a adding a targeted special case in |
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.2.1-RC2
Minimized code
Output
Expectation
Should compile. I understand that
Nothing
is inferrable here and that I should not expect.member
to be able to constrain the type ofT
. SinceNothing <: Person
I suppose it makes sense to infer the tightest type, but does it? Scala widens types in many places and I'm not sure there's any reason to ever want to inferNothing
here. This case is simple enough that I suspect it is intended behavior, but I'm still curious.The text was updated successfully, but these errors were encountered: