Commit 97d92ad
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 e2ea418 commit 97d92ad
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 | |
|---|---|---|---|
| |||
2788 | 2788 | | |
2789 | 2789 | | |
2790 | 2790 | | |
2791 | | - | |
| 2791 | + | |
2792 | 2792 | | |
2793 | 2793 | | |
2794 | 2794 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
395 | 403 | | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | 404 | | |
400 | 405 | | |
401 | 406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1484 | 1484 | | |
1485 | 1485 | | |
1486 | 1486 | | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
1487 | 1492 | | |
1488 | 1493 | | |
1489 | 1494 | | |
| |||
1615 | 1620 | | |
1616 | 1621 | | |
1617 | 1622 | | |
1618 | | - | |
| 1623 | + | |
1619 | 1624 | | |
1620 | 1625 | | |
1621 | 1626 | | |
| |||
| 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