File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 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 {
2525 /** Transforms the type to include decls for specialized applys */
2626 override def transformInfo (tp : Type , sym : Symbol )(using Context ) = tp match {
2727 case tp : ClassInfo =>
28- val newApplys = new mutable.ListBuffer [Symbol ]
2928 val apply = tp.decls.lookup(nme.apply)
30-
3129 if (! apply.exists) return tp
3230
31+ val newApplys = new mutable.ListBuffer [Symbol ]
32+
3333 var arity = 0
3434 while (arity < 3 ) {
3535 val func = defn.FunctionClass (arity)
@@ -72,7 +72,8 @@ class SpecializeFunctions extends MiniPhase with InfoTransformer {
7272 override def transformTemplate (tree : Template )(using Context ) = {
7373 val cls = tree.symbol.owner.asClass
7474
75- if (! derivesFromFn012(cls)) return tree
75+ val apply = cls.info.decls.lookup(nme.apply)
76+ if (! apply.exists || ! derivesFromFn012(cls)) return tree
7677
7778 val applyBuf = new mutable.ListBuffer [Tree ]
7879 val newBody = tree.body.mapConserve {
You can’t perform that action at this time.
0 commit comments