Commit 62fe541
committed
New strategy for polymorphic overloads with apply members
Instead of doing overload selection directly on the result of the
PolyType which contains unbounded paramrefs, we now first call
`wildApprox` to get rid of the paramrefs. The resulting behavior is
different from what Scala 2 does, but it makes polymorphic overloads
with apply members behave more like polymorphic overloads with a
parameter list, e.g given:
def a(x: Any): Any
def a[T <: Int]: T => T
a(1)
def b(x: Any): Any
def b[T <: Int](x: T): T
b(1)
in both cases the second overload will be selected.1 parent 743ab1f commit 62fe541
File tree
2 files changed
+4
-5
lines changed- compiler/src/dotty/tools/dotc/typer
- tests/neg
2 files changed
+4
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1521 | 1521 | | |
1522 | 1522 | | |
1523 | 1523 | | |
1524 | | - | |
| 1524 | + | |
1525 | 1525 | | |
1526 | 1526 | | |
1527 | 1527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
0 commit comments