From 59048872386efd521750acdd4690f40d905d7936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Akg=C3=BCn?= Date: Sat, 13 Apr 2024 23:10:28 +0100 Subject: [PATCH] bugfix: bubbling up through comprehensions that contain lettings --- src/Conjure/Rules/BubbleUp.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Conjure/Rules/BubbleUp.hs b/src/Conjure/Rules/BubbleUp.hs index 45eaeb3605..86efcbb87b 100644 --- a/src/Conjure/Rules/BubbleUp.hs +++ b/src/Conjure/Rules/BubbleUp.hs @@ -192,13 +192,12 @@ rule_LiftVars = "bubble-up-LiftVars" `namedRule` theRule where -- discard for now (_conditions, generators) <- fmap mconcat $ forM gensOrConds $ \ goc -> case goc of Condition{} -> return ([goc], []) - ComprehensionLetting{} -> return ([goc], []) - Generator (GenDomainHasRepr patName domain) -> return ([], [(patName, domain)]) + ComprehensionLetting{} -> return ([], [goc]) + Generator (GenDomainHasRepr _ _) -> return ([], [goc]) _ -> na "rule_LiftVars" - - let patRefs = [ Reference patName Nothing | (patName, _) <- generators ] - let indexDomains = map snd generators + let patRefs = [ Reference patName Nothing | Generator (GenDomainHasRepr patName _domain) <- generators ] + let indexDomains = [domain | Generator (GenDomainHasRepr _patName domain) <- generators ] let upd (Reference nm _) | nm `elem` map fst decls = let r = Reference nm Nothing @@ -212,7 +211,7 @@ rule_LiftVars = "bubble-up-LiftVars" `namedRule` theRule where ] let consLifted = - [ make opAnd $ Comprehension c [Generator (GenDomainHasRepr n d) | (n,d) <- generators] + [ make opAnd $ Comprehension c generators | c <- transformBi upd cons ]