-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Type variables in implicit result are narrowed too eagerly #6385
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
This is a tough one. Here's Dotty's algorithm for type checking
where
This is indeed incomplete since it ignores the possibility that
If we decompose this to I am not sure how else to decompose this subtyping judgment /cc @adriaanm. EDIT: No, it's actually quite clear what should be done: Add the constraint |
The issue scala#6385 contains more explanations.
The issue scala#6385 contains more explanations.
The issue scala#6385 contains more explanations.
The issue scala#6385 contains more explanations.
Example:
Expected:
Search for Tc1 should succeed, since
F[X]
always matchesTc1[X]
(Scala 2 behavior)Actual:
Search fails with
Seems like
F
is narrowed to target type Tc1 overeagerly, with all implicit summons then following that assumptions, although it should probably only be constrained to a subtype of Tc1 instead.The text was updated successfully, but these errors were encountered: