Skip to content

Commit be8c3ba

Browse files
authored
Merge pull request #3985 from dotty-staging/fix-#3930
Fix #3930: Handle multiple type arguments in overloading resolution
2 parents 3b5419d + 6ff32d6 commit be8c3ba

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,8 +1389,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
13891389
}
13901390
}
13911391

1392-
case pt @ PolyProto(targs1, pt1) =>
1393-
assert(targs.isEmpty)
1392+
case pt @ PolyProto(targs1, pt1) if targs.isEmpty =>
13941393
val alts1 = alts filter pt.isMatchedBy
13951394
resolveOverloaded(alts1, pt1, targs1)
13961395

tests/neg/i3930.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
object A {
2+
def a[F](x: Int) = 0
3+
def a[F](x: String) = 0
4+
}
5+
object Test extends App {
6+
A.a[String][Int](3) == 1 // error: ambiguous
7+
}

tests/run/i3930.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Apply { def apply[A](x: Int) = 1 }
2+
object A {
3+
def a[F] = new Apply
4+
def a[F](x: String) = 0
5+
}
6+
object Test extends App {
7+
assert(A.a[String][Int](3) == 1)
8+
}

0 commit comments

Comments
 (0)