Commit b824375
authored
Throw a type error when using hk-types in unions or intersections (#16712)
Throw a type error instead of crashing when using higher-kinded types in
unions or intersections.
We check kindedness only in PostTyper (to avoid cycles), which means we
might get into situations where we combine a higher-kinded type in a
union or intersection, which is illegal. In this case we now diagnose
the problem with a TypeError instead of failing an assert. However,
after Typer we do fail since by then such situations should have been
checked by then.
Fixes #16696File tree
4 files changed
+47
-10
lines changed- compiler
- src/dotty/tools/dotc/core
- test/dotty/tools/repl
- tests/neg
4 files changed
+47
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1071 | 1071 | | |
1072 | 1072 | | |
1073 | 1073 | | |
1074 | | - | |
| 1074 | + | |
1075 | 1075 | | |
1076 | 1076 | | |
1077 | 1077 | | |
| |||
3322 | 3322 | | |
3323 | 3323 | | |
3324 | 3324 | | |
3325 | | - | |
3326 | | - | |
3327 | | - | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
3328 | 3329 | | |
3329 | | - | |
3330 | 3330 | | |
3331 | 3331 | | |
3332 | 3332 | | |
| |||
3366 | 3366 | | |
3367 | 3367 | | |
3368 | 3368 | | |
3369 | | - | |
| 3369 | + | |
3370 | 3370 | | |
3371 | 3371 | | |
3372 | 3372 | | |
| |||
3399 | 3399 | | |
3400 | 3400 | | |
3401 | 3401 | | |
3402 | | - | |
3403 | | - | |
3404 | | - | |
3405 | 3402 | | |
3406 | 3403 | | |
3407 | 3404 | | |
| |||
3476 | 3473 | | |
3477 | 3474 | | |
3478 | 3475 | | |
| 3476 | + | |
| 3477 | + | |
| 3478 | + | |
3479 | 3479 | | |
3480 | 3480 | | |
3481 | 3481 | | |
| |||
3506 | 3506 | | |
3507 | 3507 | | |
3508 | 3508 | | |
| 3509 | + | |
| 3510 | + | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
3509 | 3514 | | |
3510 | 3515 | | |
3511 | 3516 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments