on master help sign in
Fix bug when the E in "case E of ..." is not a local variable
commit0d111c075e9c99bd32778c2cc62e54f6933e79e4 authorEvan Czaplicki <evancz@users.noreply.github.com> dateFri 26 Jan 2018, 20:57 (9 years ago) parentba0b721
1 file changed+2−1
src/Optimize/Expression.hs+2−1
src/Optimize/Expression.hs+2−1
@@ -140,7 +140,8 @@ optimize cycle (A.At region expression) =
140140 Case.optimize temp root <$> traverse (optimizeBranch root) branches
141141
142142 _ ->
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)
144145
145146 Can.Accessor field ->
146147 Names.registerField field (Opt.Accessor field)