-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use more context for implicit search only if no default argument #23664
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
Both |
We now use a blend of the new scheme and backwards compatible special case if type variables as ClassTag arguments are constrained by further type variables. Fixes scala#23611
After an "implicit not found", we type additional arguments to get more context which might give a larger implicit scope to search. With this commit we do that only if there is no default argument for the implicit. This might fix scala#23610
I think there's nothing more I can do to make coulomb compile. |
@som-snytt Since you recently worked in that corner, do you want to take a look for a review? |
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.
LGTM! as they say blithely. With the caveat that I'm only partly up to speed, I wonder if tightening constraints would work better when the named application is subsequently typed. When defaults are tried, you have the opportunity for additional shenanigans (better constraints for certain failed args that I'm suspicious of an inference decision depending on whether I have a default arg, since people are already confused about that competition between givens and defaults. I don't know anything about the mechanics of constraints; and I haven't yet understood concretely what the On the Pekko ticket, minimal test is at https://github.com/scala/scala3/pull/23556/files and only involves a couple of givens. At bottom, inference breaks when the default is used, where the context bound is in the same param list.
TIL Pekko is a "Tower of Hanoi" of implicit conversions; with some debug, maybe I'll see what it's doing when the typer reset makes it forget what |
I cloned coulomb this morning; I'll take another look if it stays broken in a way that is not terribly urgent. |
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.
Just on the default arg check, I expressed dubiousness. But not regressing is also nice. I will have different opinions when I'm less ignorant.
The original change in #23532 does change where implicit conversions are inserted. Any propagation of info from the result into a typing does that since it implicitly assumes that the info is not invalidated by an implicit conversion. So I am not terribly surprised that Pekko is affected. |
@som-snytt, @odersky Can one of you approve, then we can merge this. |
After an "implicit not found", we type additional arguments to get more context which might
give a larger implicit scope to search. With this commit we do that only if there is no
default argument for the implicit.
Based on #23659
This might fix #23610