Skip to content

Commit 40a1f44

Browse files
Merge pull request #13651 from dotty-staging/fix-13526
Normalize prototype before decomposing as a function
2 parents 307fcc4 + 3cfda90 commit 40a1f44

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ class Typer extends Namer
11441144
case _ => mapOver(t)
11451145
}
11461146

1147-
val pt1 = pt.stripTypeVar.dealias
1147+
val pt1 = pt.stripTypeVar.dealias.normalized
11481148
if (pt1 ne pt1.dropDependentRefinement)
11491149
&& defn.isContextFunctionType(pt1.nonPrivateMember(nme.apply).info.finalResultType)
11501150
then

tests/pos/i13526.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
type ~>[Args <: Tuple, Return] = Args match {
2+
case (arg1, arg2) => ((arg1, arg2) => Return)
3+
}
4+
5+
trait Builder[Args <: NonEmptyTuple] {
6+
def apply(f: Args ~> String): String
7+
}
8+
9+
class BuilderImpl[Args <: NonEmptyTuple] extends Builder[Args] {
10+
override def apply(f: Args ~> String): String = ???
11+
}
12+
13+
val builder = BuilderImpl[Int *: String *: EmptyTuple]()
14+
// builder { (i: Int, s: String) => "test" } // This line compiles
15+
val _ = builder { (i, s) => "test" } // Does not compile

0 commit comments

Comments
 (0)