Commit b8c5ecb
authored
Fix stale symbols connected to lazy vals in macros (#21559)
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.
In the issue reproduction, we had a symbol created in the `LazyVals`
phase, which was then later moved to a companion class in `MoveStatics`
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).File tree
4 files changed
+23
-1
lines changed- compiler/src/dotty/tools/dotc/core
- tests/pos-macros/i21271
4 files changed
+23
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
755 | 755 | | |
756 | 756 | | |
757 | 757 | | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
758 | 763 | | |
759 | 764 | | |
760 | 765 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2680 | 2680 | | |
2681 | 2681 | | |
2682 | 2682 | | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
2683 | 2687 | | |
2684 | 2688 | | |
2685 | 2689 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments