@@ -75,19 +75,10 @@ object BetaReduce:
75
75
val bindingsBuf = new ListBuffer [DefTree ]
76
76
def recur (fn : Tree , argss : List [List [Tree ]]): Option [Tree ] = fn match
77
77
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))
82
79
case Block ((TypeDef (_, template : Template )) :: Nil , Typed (Apply (Select (New (_), _), _), _)) if template.constr.rhs.isEmpty =>
83
80
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))
91
82
case _ => None
92
83
case Block (stats, expr) if stats.forall(isPureBinding) =>
93
84
recur(expr, argss).map(cpy.Block (fn)(stats, _))
0 commit comments