@@ -51,7 +51,7 @@ mapSnd func (x, a) =
5151-- CONVERT DEFINITIONS
5252
5353detectTailRecursion :: Can.Def -> Opt.Def
54−detectTailRecursion (Can.Definition _ pattern expression _) =
54+detectTailRecursion (Can.Definition canonFacts pattern expression _) =
5555 let
5656 (args, body) =
5757 Expr.collectLambdas expression
@@ -71,9 +71,14 @@ detectTailRecursion (Can.Definition _ pattern expression _) =
7171
7272 lambda x e =
7373 A.A () (Lambda x e)
74+
75+ facts =
76+ Opt.Facts
77+ (if isTailCall then fmap fst context else Nothing)
78+ (Can.freeVariables canonFacts)
7479 in
7580 Opt.Definition
76− (Opt.Facts (if isTailCall then fmap fst context else Nothing))
81+ facts
7782 (removeAnnotations pattern)
7883 (foldr lambda optExpr (map removeAnnotations args))
7984