Commit 743ab1f
committed
Handle polymorphic overloads with apply members
When we do overloading resolution, we first replace alternatives that
could not possibly match the expected type by their `apply` members if
they exist, however the existing logic failed to select `apply` members
from the result of a polymorphic parameterless def. We fix this by
simply replacing the PolyType by its result type without making up any
type variable, the resulting behavior matches the existing behavior of
Scala 2 on the added test file.1 parent 646e433 commit 743ab1f
File tree
2 files changed
+33
-1
lines changed- compiler/src/dotty/tools/dotc/typer
- tests/neg
2 files changed
+33
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1518 | 1518 | | |
1519 | 1519 | | |
1520 | 1520 | | |
1521 | | - | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
1522 | 1530 | | |
1523 | 1531 | | |
1524 | 1532 | | |
| |||
| 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 | + | |
| 24 | + | |
0 commit comments