diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index 155893ad6573..b87f97e53e66 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -1388,8 +1388,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic => } } - case pt @ PolyProto(targs1, pt1) => - assert(targs.isEmpty) + case pt @ PolyProto(targs1, pt1) if targs.isEmpty => val alts1 = alts filter pt.isMatchedBy resolveOverloaded(alts1, pt1, targs1) diff --git a/tests/neg/i3930.scala b/tests/neg/i3930.scala new file mode 100644 index 000000000000..46a5abb95f5a --- /dev/null +++ b/tests/neg/i3930.scala @@ -0,0 +1,7 @@ +object A { + def a[F](x: Int) = 0 + def a[F](x: String) = 0 +} +object Test extends App { + A.a[String][Int](3) == 1 // error: ambiguous +} diff --git a/tests/run/i3930.scala b/tests/run/i3930.scala new file mode 100644 index 000000000000..99b8eeede4bd --- /dev/null +++ b/tests/run/i3930.scala @@ -0,0 +1,8 @@ +class Apply { def apply[A](x: Int) = 1 } +object A { + def a[F] = new Apply + def a[F](x: String) = 0 +} +object Test extends App { + assert(A.a[String][Int](3) == 1) +}