Skip to content

Commit 9ad78c0

Browse files
committed
Fix synthesizing tupled functions
We spread the erasedness of tupled functions to all the parameters.
1 parent 0205734 commit 9ad78c0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
109109
case AppliedType(_, funArgs @ fun :: tupled :: Nil) =>
110110
def functionTypeEqual(baseFun: Type, actualArgs: List[Type],
111111
actualRet: Type, expected: Type) =
112+
val efp = defn.erasedFunctionParameters(baseFun)
113+
assert(efp.size == 1)
114+
val erasedParams = actualArgs.map(_ => efp(0))
112115
expected =:= defn.FunctionOf(actualArgs, actualRet,
113-
defn.isContextFunctionType(baseFun), defn.erasedFunctionParameters(baseFun))
116+
defn.isContextFunctionType(baseFun), erasedParams)
114117
val arity: Int =
115118
if defn.isErasedFunctionType(fun) || defn.isErasedFunctionType(fun) then -1 // TODO support?
116119
else if defn.isFunctionType(fun) then

0 commit comments

Comments
 (0)