Fix bug in (case EXPR of ...) in tail calls
commit1b73f5f5f3c5c4dfcbd4bfc362a4093b30d87dc9
authorEvan Czaplicki <evancz@users.noreply.github.com>
dateTue 30 Jan 2018, 15:03 (9 years ago)
parenta31f730
src/Optimize/Expression.hs+2−1
@@ -402,7 +402,8 @@ optimizeTail cycle rootName argNames locExpr@(A.At _ expression) =
402402 Case.optimize temp root <$> traverse (optimizeBranch root) branches
403403
404404 _ ->
405− Case.optimize temp temp <$> traverse (optimizeBranch temp) branches
405+ do obranches <- traverse (optimizeBranch temp) branches
406+ return $ Opt.Let (Opt.Def temp oexpr) (Case.optimize temp temp obranches)
406407
407408 _ ->
408409 optimize cycle locExpr