Fix stale symbols connected to lazy vals in macros #21559
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While bringing forward the denotation to a new run, we now check if the symbol was moved from its owner to a companion object. If so, we return NoDenotation, as that denotation seems to be a leftover from pre-MoveStatics phases in a previous run.
Fixes #21271
In the issue reproduction, we had a symbol created in the
LazyVals
phase, which was then later moved to a companion class inMoveStatics
in the first run. In the second run, this caused the leftover denotation for pre-MoveStatics phases of the first run to be tried to brought forward (since the phaseID became valid at that point), failing to do so (because that symbol should no longer exist as a member of the initial companion object at that point).It looks like before #19786, since this denotation was valid at a later phase, it would be visited somewhere before the MegaPhase with
LazyVals
and replaced with a NoDenotation (pretty much by accident), which back then ended up being cached for the latter phases as well.So in the fix here we check for that specific
MoveStatics
-caused case and, if found, update the symbol with a NoDenotation (just like before, but this time, on purpose).