forked from ucsd-progsys/liquidhaskell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8aaceac
commit 943cc45
Showing
5 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
tests/datacon/neg/AutoliftedFields.hs → tests/datacon/neg/AutoliftedFields00.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{-@ LIQUID "--exact-data-cons" @-} | ||
|
||
-- data decl in LH and Haskell do not match and the LH one is not a subtype | ||
|
||
module AutoliftedFields01 where | ||
|
||
{-@ type Nat = { v : Int | v >= 0 } @-} | ||
type Nat = Int | ||
|
||
{-@ data T = T { getT :: Float } @-} | ||
data T = T { getT :: Nat } | ||
|
||
{-@ f :: { t : T | getT t >= 1 } -> Nat @-} | ||
f :: T -> Nat | ||
f (T x) = x |
4 changes: 3 additions & 1 deletion
4
tests/datacon/pos/AutoliftedFields.hs → tests/datacon/pos/AutoliftedFields00.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{-@ LIQUID "--exact-data-cons" @-} | ||
|
||
-- data decl in LH and Haskell give different names to the fields, but use them | ||
-- in valid ways. | ||
|
||
module AutoliftedFields01 where | ||
|
||
{-@ type Nat = { v : Int | v >= 0 } @-} | ||
type Nat = Int | ||
|
||
{-@ data T = T { getMyT :: Nat } @-} | ||
data T = T { getT :: Nat } | ||
|
||
{-@ f :: { t : T | getT t == getMyT t } -> Nat @-} | ||
f :: T -> Nat | ||
f (T x) = x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{-@ LIQUID "--exact-data-cons" @-} | ||
|
||
-- data decl in LH and Haskell do not match but the LH is a subtype | ||
|
||
module AutoliftedFields02 where | ||
|
||
{-@ type Nat = { v : Int | v >= 0 } @-} | ||
type Nat = Int | ||
|
||
{-@ data T = T { getT :: Nat } @-} | ||
data T = T { getT :: Int } | ||
|
||
{-@ f :: { t : T | getT t >= 0 } -> Nat @-} | ||
f :: T -> Nat | ||
f (T x) = x |