File tree 1 file changed +4
-3
lines changed
compiler/src/dotty/tools/dotc/transform 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,11 @@ class SpecializeFunctions extends MiniPhase with InfoTransformer {
25
25
/** Transforms the type to include decls for specialized applys */
26
26
override def transformInfo (tp : Type , sym : Symbol )(using Context ) = tp match {
27
27
case tp : ClassInfo =>
28
- val newApplys = new mutable.ListBuffer [Symbol ]
29
28
val apply = tp.decls.lookup(nme.apply)
30
-
31
29
if (! apply.exists) return tp
32
30
31
+ val newApplys = new mutable.ListBuffer [Symbol ]
32
+
33
33
var arity = 0
34
34
while (arity < 3 ) {
35
35
val func = defn.FunctionClass (arity)
@@ -72,7 +72,8 @@ class SpecializeFunctions extends MiniPhase with InfoTransformer {
72
72
override def transformTemplate (tree : Template )(using Context ) = {
73
73
val cls = tree.symbol.owner.asClass
74
74
75
- if (! derivesFromFn012(cls)) return tree
75
+ val apply = cls.info.decls.lookup(nme.apply)
76
+ if (! apply.exists || ! derivesFromFn012(cls)) return tree
76
77
77
78
val applyBuf = new mutable.ListBuffer [Tree ]
78
79
val newBody = tree.body.mapConserve {
You can’t perform that action at this time.
0 commit comments