Skip to content

Commit

Permalink
bugfix: bubbling up through comprehensions that contain lettings
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgurakgun committed Apr 13, 2024
1 parent 1cf7f33 commit 5904887
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Conjure/Rules/BubbleUp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
]

Expand Down

0 comments on commit 5904887

Please sign in to comment.