Skip to content

Commit 30ec4b6

Browse files
authored
Merge pull request #1605 from ucsd-progsys/T1603
fix for #T1603
2 parents 11cc7e3 + 1f7a4ca commit 30ec4b6

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/Language/Haskell/Liquid/Transforms/CoreToLogic.hs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,23 @@ toPredApp p = go . Misc.mapFst opSym . splitArgs $ p
384384
= PAnd <$> mapM coreToLg [e1, e2]
385385
| f == symbol ("==>" :: String)
386386
= PImp <$> coreToLg e1 <*> coreToLg e2
387-
go (Just f, es)
387+
go (Just f, [es])
388388
| f == symbol ("or" :: String)
389-
= POr <$> mapM coreToLg es
389+
= POr . deList <$> coreToLg es
390390
| f == symbol ("and" :: String)
391-
= PAnd <$> mapM coreToLg es
391+
= PAnd . deList <$> coreToLg es
392392
go (_, _)
393393
= toLogicApp p
394+
395+
deList :: Expr -> [Expr]
396+
deList (EApp (EApp (EVar cons) e) es)
397+
| cons == symbol ("GHC.Types.:" :: String)
398+
= e:deList es
399+
deList (EVar nil)
400+
| nil == symbol ("GHC.Types.[]" :: String)
401+
= []
402+
deList e
403+
= [e]
394404

395405
toLogicApp :: C.CoreExpr -> LogicM Expr
396406
toLogicApp e = do

tests/pos/T1603.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{-@ LIQUID "--reflect" @-}
2+
3+
{-@ reflect rAnd @-}
4+
rAnd :: Bool
5+
rAnd = and [True,False,True]
6+
7+
{-@ reflect rOr @-}
8+
rOr :: Bool
9+
rOr = or [True,False,True]
10+

0 commit comments

Comments
 (0)