Skip to content

Commit 102bfd5

Browse files
oderskynicolasstucki
authored andcommitted
Make overloading resolution work for embedded type params
Make overloading resulution work in the case where type parameters follow value parameters.
1 parent 89fd8f4 commit 102bfd5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1929,7 +1929,7 @@ trait Applications extends Compatibility {
19291929
else
19301930
val deepPt = pt.deepenProto
19311931
deepPt match
1932-
case pt @ FunProto(_, resType: FunProto) =>
1932+
case pt @ FunProto(_, resType: FunOrPolyProto) =>
19331933
// try to narrow further with snd argument list
19341934
resolveMapped(candidates, skipParamClause(pt.typedArgs().tpes), resType)
19351935
case _ =>

tests/pos/extmethods.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,13 @@ object CC extends TT:
4545
val m = Nil
4646

4747
val xx = CC.foo(List(1, 2, 3))
48+
49+
extension (x: TT)
50+
def ff[X](): Int = 1
51+
def ff[X](s: String): Int = s.length
52+
def ff[X](n: Int): Int = n
53+
54+
val yy =
55+
CC.ff[Int]()
56+
+ CC.ff[String]("abc")
57+
+ CC.ff[Int](22)

0 commit comments

Comments
 (0)