Commit 0f708eb
committed
Keep order of operands in AndTypes invariant
We previously could get the following:
Given:
class A
trait B extends A
trait C extends A
Then
(A & B) & C
simplified to
C & B
This is usually not a problem, *except* for typing super calls, where we pick
the symbol of the right operand. The problem was masked because due to the wrong
computation of base classes for AndTypes, we always ended up picking the leftmost
symbol in a joint denotation instead of the rightmost one. So we got a double swap!
The problem is reproducible in the test case. It originally manifested itself only
in the bootstrap, and only under a particular order of compiling files, which was
exercised by the CI but initially not by my local setup. The summary of the problem is as follows:
ElimRepeated has the structure of ER in the test case. Because of
the problem, a super call in `transform` of `ElimRepeated` went to `InfoTransformers` instead
of `AnnotationTransformers`. Consequently, the elim repeated transform was not done on
annotations, which led to backend crashes of the bootstrapped compiler for those annotations
that had repeated arguments. It took me two full days to get to the bottom of this.
Must rank right at the top of the list of hard-to-find bugs for me.
Note: It would seem logical to apply a similar technique to OrTypes. But this currently fails some tests. Need to investigate later.1 parent 953e8db commit 0f708eb
File tree
3 files changed
+59
-5
lines changed- compiler/src/dotty/tools/dotc/core
- tests/run
3 files changed
+59
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1143 | 1143 | | |
1144 | 1144 | | |
1145 | 1145 | | |
1146 | | - | |
1147 | | - | |
| 1146 | + | |
| 1147 | + | |
1148 | 1148 | | |
1149 | | - | |
1150 | | - | |
| 1149 | + | |
| 1150 | + | |
1151 | 1151 | | |
1152 | 1152 | | |
1153 | 1153 | | |
| |||
1161 | 1161 | | |
1162 | 1162 | | |
1163 | 1163 | | |
1164 | | - | |
| 1164 | + | |
1165 | 1165 | | |
1166 | 1166 | | |
1167 | 1167 | | |
| |||
1204 | 1204 | | |
1205 | 1205 | | |
1206 | 1206 | | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
1207 | 1223 | | |
1208 | 1224 | | |
1209 | 1225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
17 | 45 | | |
18 | 46 | | |
19 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
20 | 53 | | |
21 | 54 | | |
22 | 55 | | |
0 commit comments