From 466d29f7fadaa3e09f5da101102a06faf12704bf Mon Sep 17 00:00:00 2001 From: Felix Wittwer Date: Wed, 17 Apr 2019 14:14:53 +0200 Subject: [PATCH] Fix error for #36 --- core/src/Ohua/Feature/TailRec/Passes/ALang.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/Ohua/Feature/TailRec/Passes/ALang.hs b/core/src/Ohua/Feature/TailRec/Passes/ALang.hs index 933d672..9ba921e 100644 --- a/core/src/Ohua/Feature/TailRec/Passes/ALang.hs +++ b/core/src/Ohua/Feature/TailRec/Passes/ALang.hs @@ -436,8 +436,8 @@ rewriteCallExpr e = do falseB' = rewriteBranch falseB (fixRef, recurVars) = case (trueB', falseB') of - (Left f, Right bnds) -> (f, bnds) - (Right bnds, Left f) -> error $ "I am sorry, but for now the recursion is required to be on the first (`then`) branch of the final condition. This is a bug of the implementation and will be fixed in the future. (Issue #36)\n\nYour code violating this invariant was\n" <> show (PP.indent 4 $ PP.pretty fullExpr) -- (f, bnds) + (Left f, Right bnds) -> error $ "I am sorry, but for now the recursion is required to be on the first (`then`) branch of the final condition. This is a bug of the implementation and will be fixed in the future. (Issue #36)\n\nYour code violating this invariant was\n" <> show (PP.indent 4 $ PP.pretty fullExpr) -- (f, bnds) + (Right bnds, Left f) -> (f, bnds) _ -> error "invariant broken" in fromListToApply (FunRef recurEndMarker Nothing) $ cond : fixRef : recurVars