Commit d7922bd
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 183ec08 commit d7922bd
File tree
2 files changed
+12
-12
lines changed- compiler/src/dotty/tools/dotc/transform
2 files changed
+12
-12
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: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 49 | | |
54 | 50 | | |
55 | 51 | | |
| 52 | + | |
| 53 | + | |
56 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
0 commit comments