@@ -34,24 +34,24 @@ class SpecializeApplyMethods extends MiniPhase with InfoTransformer {
3434 atNextPhase(newSymbol(sym, name, Flags .Method , MethodType (args, ret)))
3535 }
3636
37- private def specFun0 (op : Type => Unit )(using Context ): Unit = {
37+ private inline def specFun0 (inline op : Type => Unit )(using Context ): Unit = {
3838 for (r <- defn.Function0SpecializedReturnTypes ) do
3939 op(r)
4040 }
4141
42- private def specFun1 (op : (Type , Type ) => Unit )(using Context ): Unit = {
42+ private inline def specFun1 (inline op : (Type , Type ) => Unit )(using Context ): Unit = {
4343 for
4444 r <- defn.Function1SpecializedReturnTypes
4545 t1 <- defn.Function1SpecializedParamTypes
4646 do
4747 op(t1, r)
4848 }
4949
50- private def specFun2 (op : (Type , Type , Type ) => Unit )(using Context ): Unit = {
50+ private inline def specFun2 (inline op : (Type , Type , Type ) => Unit )(using Context ): Unit = {
5151 for
5252 r <- defn.Function2SpecializedReturnTypes
5353 t1 <- defn.Function2SpecializedParamTypes
54- t2 <- defn.Function2SpecializedReturnTypes
54+ t2 <- defn.Function2SpecializedParamTypes
5555 do
5656 op(t1, t2, r)
5757 }
@@ -63,30 +63,29 @@ class SpecializeApplyMethods extends MiniPhase with InfoTransformer {
6363
6464 /** Add symbols for specialized methods to FunctionN */
6565 override def transformInfo (tp : Type , sym : Symbol )(using Context ) = tp match {
66- // case tp: ClassInfo =>
67- // if sym == defn.SpecializableFunctions(0) then
68- // val scope = tp.decls.cloneScope
69- // specFun0 { r => scope.enter(specApplySymbol(sym, Nil, r)) }
70- // tp.derivedClassInfo(decls = scope)
66+ case tp : ClassInfo =>
67+ if sym == defn.SpecializableFunctions (0 ) then
68+ val scope = tp.decls.cloneScope
69+ specFun0 { r => scope.enter(specApplySymbol(sym, Nil , r)) }
70+ tp.derivedClassInfo(decls = scope)
7171
72- // else if sym == defn.SpecializableFunctions(1) then
73- // val scope = tp.decls.cloneScope
74- // specFun1 { (t1, r) => scope.enter(specApplySymbol(sym, List(t1) , r)) }
75- // tp.derivedClassInfo(decls = scope)
72+ else if sym == defn.SpecializableFunctions (1 ) then
73+ val scope = tp.decls.cloneScope
74+ specFun1 { (t1, r) => scope.enter(specApplySymbol(sym, t1 :: Nil , r)) }
75+ tp.derivedClassInfo(decls = scope)
7676
77- // else if sym == defn.SpecializableFunctions(2) then
78- // val scope = tp.decls.cloneScope
79- // specFun2 { (t1, t2, r) => scope.enter(specApplySymbol(sym, List(t1, t2) , r)) }
80- // tp.derivedClassInfo(decls = scope)
77+ else if sym == defn.SpecializableFunctions (2 ) then
78+ val scope = tp.decls.cloneScope
79+ specFun2 { (t1, t2, r) => scope.enter(specApplySymbol(sym, t1 :: t2 :: Nil , r)) }
80+ tp.derivedClassInfo(decls = scope)
8181
82- // else tp
82+ else tp
8383
8484 case _ => tp
8585 }
8686
8787 /** Create bridge methods for FunctionN with specialized applys */
88- // override def transformTemplate(tree: Template)(using Context) = {
89- def transformTemplate1 (tree : Template )(using Context ) = {
88+ override def transformTemplate (tree : Template )(using Context ) = {
9089 val cls = tree.symbol.owner.asClass
9190
9291 def synthesizeApply (names : collection.Set [TermName ]): Tree = {
0 commit comments