on master help sign in
Fix bug when the E in "case E of ..." is not a local variable
0d111c0Evan Czaplicki
src/Optimize/Expression.hs+2−1
@@ -140,7 +140,8 @@ optimize cycle (A.At region expression) =
140 Case.optimize temp root <$> traverse (optimizeBranch root) branches
140 Case.optimize temp root <$> traverse (optimizeBranch root) branches
141
141
142 _ ->
142 _ ->
143− Case.optimize temp temp <$> traverse (optimizeBranch temp) branches
143+ do obranches <- traverse (optimizeBranch temp) branches
144+ return $ Opt.Let (Opt.Def temp oexpr) (Case.optimize temp temp obranches)
144
145
145 Can.Accessor field ->
146 Can.Accessor field ->
146 Names.registerField field (Opt.Accessor field)
147 Names.registerField field (Opt.Accessor field)