Commit 285c90d
committed
Verify symbol is a param by querying the reftree
In the HoistSuperArgs phase we have established which tree should be
hoisted, and replace all references in the Tree with params that are
accessible in the hoisted tree.
When the Tree contains an anonymous class without parameters,
the paramSyms of that class refer to the created 'fresh' super symbol
(e.g. `B$superArg$1`), while the RefTree symbol belongs to the
superclass `B`.
This meant that the conditional was never satisfied, and the type was
never replaced by the primary constructor argument of the generated
superArg class.
In the current design `treeMap` is called before `typeMap` on a given
tree, thus the code in `treeMap` was never executed.
This is mitigated by rewriting the check, to only take params or
accessors into account in the scope of the hoisted tree.1 parent 1b00033 commit 285c90d
File tree
3 files changed
+25
-4
lines changed- compiler/src/dotty/tools/dotc/transform
- tests/pos
3 files changed
+25
-4
lines changedLines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
119 | 126 | | |
120 | 127 | | |
121 | 128 | | |
| |||
128 | 135 | | |
129 | 136 | | |
130 | 137 | | |
131 | | - | |
132 | | - | |
133 | | - | |
| 138 | + | |
134 | 139 | | |
135 | 140 | | |
136 | 141 | | |
| |||
140 | 145 | | |
141 | 146 | | |
142 | 147 | | |
143 | | - | |
| 148 | + | |
144 | 149 | | |
145 | 150 | | |
146 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments