@@ -165,12 +165,6 @@ class InlineReducer(inliner: Inliner)(using Context):
165165 case Apply (Select (cl, nme.apply), args) if defn.isFunctionType(cl.tpe) =>
166166 val bindingsBuf = new DefBuffer
167167 def recur (cl : Tree ): Option [Tree ] = cl match
168- case Inlined (call, bindings, expr) if bindings.forall(isPureBinding) =>
169- recur(expr).map(cpy.Inlined (cl)(call, bindings, _))
170- case Block (Nil , expr) =>
171- recur(expr).map(cpy.Block (cl)(Nil , _))
172- case Typed (expr, tpt) =>
173- recur(expr)
174168 case Block ((ddef : DefDef ) :: Nil , closure : Closure ) if ddef.symbol == closure.meth.symbol =>
175169 ddef.tpe.widen match
176170 case mt : MethodType if ddef.paramss.head.length == args.length =>
@@ -190,6 +184,12 @@ class InlineReducer(inliner: Inliner)(using Context):
190184 substTo = argSyms)
191185 Some (expander.transform(ddef.rhs))
192186 case _ => None
187+ case Block (stats, expr) if stats.forall(isPureBinding) =>
188+ recur(expr).map(cpy.Block (cl)(stats, _))
189+ case Inlined (call, bindings, expr) if bindings.forall(isPureBinding) =>
190+ recur(expr).map(cpy.Inlined (cl)(call, bindings, _))
191+ case Typed (expr, tpt) =>
192+ recur(expr)
193193 case _ => None
194194 recur(cl) match
195195 case Some (reduced) =>
0 commit comments