@@ -77,50 +77,6 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
7777 }
7878 end synthesizedTypeTest
7979
80- val synthesizedTupleFunction : SpecialHandler = (formal, span) =>
81- formal match
82- case AppliedType (_, funArgs @ fun :: tupled :: Nil ) =>
83- def functionTypeEqual (baseFun : Type , actualArgs : List [Type ],
84- actualRet : Type , expected : Type ) =
85- expected =:= defn.FunctionOf (actualArgs, actualRet,
86- defn.isContextFunctionType(baseFun), defn.isErasedFunctionType(baseFun))
87- val arity : Int =
88- if defn.isErasedFunctionType(fun) || defn.isErasedFunctionType(fun) then - 1 // TODO support?
89- else if defn.isFunctionType(fun) then
90- // TupledFunction[(...) => R, ?]
91- fun.dropDependentRefinement.dealias.argInfos match
92- case funArgs :+ funRet
93- if functionTypeEqual(fun, defn.tupleType(funArgs) :: Nil , funRet, tupled) =>
94- // TupledFunction[(...funArgs...) => funRet, ?]
95- funArgs.size
96- case _ => - 1
97- else if defn.isFunctionType(tupled) then
98- // TupledFunction[?, (...) => R]
99- tupled.dropDependentRefinement.dealias.argInfos match
100- case tupledArgs :: funRet :: Nil =>
101- defn.tupleTypes(tupledArgs.dealias) match
102- case Some (funArgs) if functionTypeEqual(tupled, funArgs, funRet, fun) =>
103- // TupledFunction[?, ((...funArgs...)) => funRet]
104- funArgs.size
105- case _ => - 1
106- case _ => - 1
107- else
108- // TupledFunction[?, ?]
109- - 1
110- if arity == - 1 then
111- EmptyTree
112- else if arity <= Definitions .MaxImplementedFunctionArity then
113- ref(defn.RuntimeTupleFunctionsModule )
114- .select(s " tupledFunction $arity" .toTermName)
115- .appliedToTypes(funArgs)
116- else
117- ref(defn.RuntimeTupleFunctionsModule )
118- .select(" tupledFunctionXXL" .toTermName)
119- .appliedToTypes(funArgs)
120- case _ =>
121- EmptyTree
122- end synthesizedTupleFunction
123-
12480 /** If `formal` is of the form Eql[T, U], try to synthesize an
12581 * `Eql.eqlAny[T, U]` as solution.
12682 */
@@ -408,7 +364,6 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
408364 defn.ClassTagClass -> synthesizedClassTag,
409365 defn.TypeTestClass -> synthesizedTypeTest,
410366 defn.EqlClass -> synthesizedEql,
411- defn.TupledFunctionClass -> synthesizedTupleFunction,
412367 defn.ValueOfClass -> synthesizedValueOf,
413368 defn.Mirror_ProductClass -> synthesizedProductMirror,
414369 defn.Mirror_SumClass -> synthesizedSumMirror,
0 commit comments