Commit e152abe
committed
Improve invariant checks for erased terms
Instead of erasing an erased term to `???` we erase it to `erasedValue[T]`.
This has 2 advantages, first, the term does not lose its type, and second, the
term is still marked as erased. The second implies that if there is a bug in
the compiler or a macro where the term might end outside an erased context, the
code will not compiler. Currently, the code compiles and then throws when
calling the spurious `???`. See #11996.1 parent 6f1846a commit e152abe
File tree
2 files changed
+14
-14
lines changed- compiler/src/dotty/tools/dotc/transform
2 files changed
+14
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 246 | + | |
| 247 | + | |
250 | 248 | | |
251 | 249 | | |
252 | 250 | | |
| |||
282 | 280 | | |
283 | 281 | | |
284 | 282 | | |
285 | | - | |
| 283 | + | |
| 284 | + | |
286 | 285 | | |
287 | 286 | | |
288 | 287 | | |
| |||
414 | 413 | | |
415 | 414 | | |
416 | 415 | | |
417 | | - | |
| 416 | + | |
418 | 417 | | |
419 | 418 | | |
420 | 419 | | |
421 | 420 | | |
422 | | - | |
| 421 | + | |
423 | 422 | | |
424 | 423 | | |
425 | 424 | | |
| |||
Lines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 47 | + | |
52 | 48 | | |
53 | 49 | | |
54 | 50 | | |
55 | 51 | | |
| 52 | + | |
| 53 | + | |
56 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
0 commit comments