Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #1906: adding GADT fields syntax #1922

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More tests
  • Loading branch information
Fizzixnerd committed Jan 10, 2022
commit 6d564bf6d4c5fc217ef265eab981118ae00b6977
2 changes: 2 additions & 0 deletions tests/basic/neg/GADTFields00.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{-# LANGUAGE GADTs #-}

{-@ LIQUID "--exact-data-cons" @-}

-- With a refinement type embedded and then used wrongly

module GADTFields00 where
Expand Down
2 changes: 2 additions & 0 deletions tests/basic/neg/GADTFields01.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{-# LANGUAGE GADTs #-}

{-@ LIQUID "--exact-data-cons" @-}

-- With a refinement type embedded in a function using a fieldname, but with a
-- bad type

Expand Down
22 changes: 22 additions & 0 deletions tests/basic/neg/GADTFields02.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{-# LANGUAGE GADTs #-}

{-@ LIQUID "--exact-data-cons" @-}

-- With a refinement type embedded in a function using a fieldname, but with a
-- bad type

module GADTFields02 where

{-@
data T where
T :: { getT :: Int, getT' :: { v:Int | v >= 0 } } -> T
@-}
data T where
T :: { getT :: Int, getT' :: Int } -> T

{-@ f :: { v:T | getT' v < 0 } -> { x:Int | x >= 0 } @-}
f :: T -> Int
f = getT'

main :: IO ()
main = print (getT' (T 5 6))
23 changes: 23 additions & 0 deletions tests/basic/neg/GADTFields03.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{-# LANGUAGE GADTs #-}

{-@ LIQUID "--exact-data-cons" @-}

-- With a refinement type embedded in a function using a fieldname, but with a
-- bad type

module GADTFields03 where

{-@
data T a where
T :: { getT :: Int, getT' :: { v:Int | v >= 0 } } -> T Int
@-}
data T a where
T :: { getT :: Int, getT' :: Int } -> T Int
S :: { getT :: Int, getS :: String } -> T Int

{-@ f :: { v:T Int | getT' v < 0 } -> { x:Int | x >= 0 } @-}
f :: T Int -> Int
f = getT'

main :: IO ()
main = print (getT' (T 5 6))