@@ -75,19 +75,10 @@ object BetaReduce:
7575 val bindingsBuf = new ListBuffer [DefTree ]
7676 def recur (fn : Tree , argss : List [List [Tree ]]): Option [Tree ] = fn match
7777 case Block ((ddef : DefDef ) :: Nil , closure : Closure ) if ddef.symbol == closure.meth.symbol =>
78- ddef.tpe.widen match // TODO can these guards be removed?
79- case mt : MethodType if ddef.paramss.head.length == argss.head.length =>
80- Some (reduceApplication(ddef, argss, bindingsBuf))
81- case _ => None
78+ Some (reduceApplication(ddef, argss, bindingsBuf))
8279 case Block ((TypeDef (_, template : Template )) :: Nil , Typed (Apply (Select (New (_), _), _), _)) if template.constr.rhs.isEmpty =>
8380 template.body match
84- case (ddef : DefDef ) :: Nil =>
85- ddef.tpe.widen match // TODO can these guards be removed?
86- case mt : MethodType if ddef.paramss.head.length == argss.head.length =>
87- Some (reduceApplication(ddef, argss, bindingsBuf))
88- case mt : PolyType if ddef.paramss.head.length == argss.head.length && ddef.paramss.last.length == argss.last.length =>
89- Some (reduceApplication(ddef, argss, bindingsBuf))
90- case _ => None
81+ case (ddef : DefDef ) :: Nil => Some (reduceApplication(ddef, argss, bindingsBuf))
9182 case _ => None
9283 case Block (stats, expr) if stats.forall(isPureBinding) =>
9384 recur(expr, argss).map(cpy.Block (fn)(stats, _))
0 commit comments