-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix for macro annotation that resolves macro-based implicit crashing the compiler #20353
Fix for macro annotation that resolves macro-based implicit crashing the compiler #20353
Conversation
Hey, to fix the CI run, can you rebase your work on the latest commit in main ? |
9206739
to
9c14610
Compare
I rebased on the main branch. |
Hi, I've been investigating this for the past few days and I'm not sure why the closure is created. I wasn't able to reproduce the behavior with other constructs. I'm still looking into it and I will answer back here when I have a final answer. |
Thanks! 🙂 I assumed this was normal behavior for expanding macro givens, as at some point you probably want a context function |
@pweisenburger Sorry for the very late review 😅 , I had some weird behaviour in the compiler when I was playing with your changes, everything should be fixed now ! |
This changes makes the execution of the test case in #20353 stable across different run
When (1) macro-annotating a class or object nested in another class or object and (2) the annotation macro tries to summon an implicit value using
Implicits.search
and (3) the implicit search needs to expand agiven
macro, the compiler crashes with:I found that the reason for the crash is
macroDependencies
returning locally defined variables, which, I believe, it should not. In particular it returns a list containing$anonfun
for trees of the following shape that appear when resolving implicit macros:This PR skips over such
Closure
nodes, which should be the correct behavior. Not sure if there are other cases thatmacroDependencies
handles incorrectly and that should be fixed ...