-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Alternative fix for #10044 #15129
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
Alternative fix for #10044 #15129
Conversation
I think I found and fixed the bug with signature generation. |
@smarter ping for review |
This addresses the specific problem raised by scala#10044: A denotation of a NamedType goes from a UniqueRefDenotation to a SymDenotation after erasure and is then not reset to the original since the SymDenotation is valid at all phases. We remember in this case in the NamedType the first phase in which the SymDenotaton is valid and force a recompute in earlier phases. Fixes scala#10044
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.
Otherwise LGTM, I rebased and applied the suggested comment.
denot match | ||
case denot: SymDenotation | ||
if denot.validFor.firstPhaseId < ctx.phase.id | ||
&& lastDenot != null |
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.
I'm not completely sure that we won't run into issues where lastDenot didn't exist, but we need to get the denotation at an earlier phase in a subsequent run or via time-travelling. How expensive would it be to always create UniqueRefDenotation after erasure?
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.
I prefer caution here. I don't have the time to look into a change like this, which looks risky to me.
This is a better alternative to fix #10044 than #15120. Unfortunately, it fails
dotty.tools.dotc.BootstrappedOnlyCompilationTests.runWithCompiler in the
tasty interpreter test. Here I see:
If I turn on printing in line 2583 in Types.scala, I see the last output as follows:
So it does overwrite, and the overwrite looks OK, but somehow changing a SymDenotation with a UniqueRefDenotation for the same symbol messes up generic signature generation.
Can someone help me digging deeper here?