Commit 413cdf8
committed
Fix #9171: Eliminate difference _ and Any in MT
`case _ =>` use to be typed as a `HKTypeLambda`, despite not binding anything.
As a result, result of match type reduction going through `case _` would get
further reduce that their `case Any` counterpart. This commit eliminates this
distinction with the following changes:
- Eliminate this distinction in typing (type `case _ =>` *as* `case Any =>`)
- Simplify the body of match types in non-binding cases
- Change the match type/expression unification to treat the `case _ =>` in a
pattern like `case _: Any =>`
Unfortunately this change introduces a regression in `matchtype-loop.scala`
where the loop suddenly turns into an infinite loop that doesn't
stack overflow. I don't see any other way to nicely fail than to introduce a
new fuel-like counter to keep track of match type reductions.1 parent eb34c6c commit 413cdf8
File tree
6 files changed
+60
-13
lines changed- compiler/src/dotty/tools/dotc
- core
- typer
- tests
- neg-custom-args
- pos
6 files changed
+60
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2588 | 2588 | | |
2589 | 2589 | | |
2590 | 2590 | | |
2591 | | - | |
| 2591 | + | |
2592 | 2592 | | |
2593 | 2593 | | |
2594 | 2594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
418 | 426 | | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | 427 | | |
423 | 428 | | |
424 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1295 | 1295 | | |
1296 | 1296 | | |
1297 | 1297 | | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
1298 | 1303 | | |
1299 | 1304 | | |
1300 | 1305 | | |
| |||
1417 | 1422 | | |
1418 | 1423 | | |
1419 | 1424 | | |
1420 | | - | |
| 1425 | + | |
1421 | 1426 | | |
1422 | 1427 | | |
1423 | 1428 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 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 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments