-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add an -Yimplicit-to-given flag for rewrites to easily test changes in the ecosystem #22580
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
3a7cc12
to
f7dc85b
Compare
I think it would be a good idea to merge this. It can be helpful for migrating to givens. |
We probably should not merge this yet, as last time @WojciechMazur tested this with the cats repository, he detected some more differences beyond the given/implicit resolution unnaccaunted for here (e.g. implicits allow an additional empty argument list, but when replacing that with using, we get an error unrelated to what we want to be tested here). I'll try to fix those issues and will prioritize this PR over the coming days, so that this can be merged (also since we want this merged in the compiler, I'll probably need to replace the added symbol flag with something else) |
3f55011
to
357a2aa
Compare
357a2aa
to
ddbe8c5
Compare
ddbe8c5
to
71a4ae8
Compare
23646c2
to
2604288
Compare
2604288
to
cb31976
Compare
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 far as I can see. @jchyb I leave it to you to merge when you think it's ready.
Thank you! |
closes #22482
It replaces every implicit definition with
given
(including implicit classes, which I was surprised to see working), and every implicit parameter clause withusing
, all in the parser phase.Symbols and trees unpickled from tasty are unaffected by this flag. Trees generated using the reflection api are unaffected as well.
Pre
-source:3.6
context bounds are left as implicits.All of the above should be easy enough to change, but I didn't really see the purpose for it.
As I run into several issues with the previous method (where we would try to interpret implicit keywords as givens, with no changes to source code, which could lead to unclear error messages, and different behavior in dependent modules), I ended up redoing this to be rewrite-based. Now, the added flag should be used in conjunction with
--rewrite
, adding rewrite patches to the source code. This will omit implicit classes and old-style implicit conversions, where a simple rewrite togiven
orusing
might not be available.using
keywords are also added to converted previously-implicit-now-using parameter applications, but only if both the method definition and application are in the same compilation run (in other cases they would have to be added manually).