on master help sign in
Fix bug in (case EXPR of ...) in tail calls
1b73f5fEvan Czaplicki
src/Optimize/Expression.hs+2−1
@@ -402,7 +402,8 @@ optimizeTail cycle rootName argNames locExpr@(A.At _ expression) =
402 Case.optimize temp root <$> traverse (optimizeBranch root) branches
402 Case.optimize temp root <$> traverse (optimizeBranch root) branches
403
403
404 _ ->
404 _ ->
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)
406
407
407 _ ->
408 _ ->
408 optimize cycle locExpr
409 optimize cycle locExpr