Commit 44a305f
committed
Fix #1895: Use proper validity period for extension methods
When we create a symbol in a DenotationTransformer, we cannot safely
create it at phase `thisPhase.next` since this can lead to cycles. This
is why we created extension methods at phase `thisPhase`, but they're
not really valid at that point since they're only entered in their owner
once the transformer has been run. This lead to stale symbol errors
which were worked around in 51a458e but
the fix is incomplete and does not work with #4604 because that PR moves
the ExtensionMethods phase around.
This commit removes all the workarounds and uses a simpler solution:
create the symbols at phase `thisPhase` but set their validity
period to match the validity of the owner transformed denotation.1 parent 7aa1ee2 commit 44a305f
File tree
2 files changed
+32
-32
lines changed- compiler/src/dotty/tools/dotc
- core
- transform
2 files changed
+32
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
61 | 57 | | |
62 | 58 | | |
63 | 59 | | |
| |||
Lines changed: 29 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
89 | 76 | | |
90 | 77 | | |
91 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| |||
0 commit comments