diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-01-22 13:01:55 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-01-22 14:20:30 +0100 |
commit | 2df422161bccf7c0fad97e468085ebab1a17e19e (patch) | |
tree | 84798e2b3667a1612c7708ed6e93332b4c1c61f5 /testsuite/tests | |
parent | 835a2a24a605f8e458f57c71aa67e9983593b5e4 (diff) | |
download | haskell-2df422161bccf7c0fad97e468085ebab1a17e19e.tar.gz |
Add tests for #11465 and the kind invariant
Diffstat (limited to 'testsuite/tests')
7 files changed, 42 insertions, 1 deletions
diff --git a/testsuite/tests/indexed-types/should_run/T11465a.hs b/testsuite/tests/indexed-types/should_run/T11465a.hs new file mode 100644 index 0000000000..41fc19738c --- /dev/null +++ b/testsuite/tests/indexed-types/should_run/T11465a.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TypeInType #-} + +import GHC.Exts +import GHC.Types + +class BoxIt (a :: TYPE 'Unlifted) where + type Boxed a :: * + boxed :: a -> Boxed a + +instance BoxIt Char# where + type Boxed Char# = Char + boxed x = C# x + +main :: IO () +main = print $ boxed 'c'# diff --git a/testsuite/tests/indexed-types/should_run/T11465a.stdout b/testsuite/tests/indexed-types/should_run/T11465a.stdout new file mode 100644 index 0000000000..40765836b0 --- /dev/null +++ b/testsuite/tests/indexed-types/should_run/T11465a.stdout @@ -0,0 +1 @@ +'c' diff --git a/testsuite/tests/indexed-types/should_run/all.T b/testsuite/tests/indexed-types/should_run/all.T index f5c8c5c4fa..8d72c4693c 100644 --- a/testsuite/tests/indexed-types/should_run/all.T +++ b/testsuite/tests/indexed-types/should_run/all.T @@ -6,3 +6,4 @@ test('T4235', normal, compile_and_run, ['']) test('GMapAssoc', normal, compile_and_run, ['-package containers']) test('GMapTop', normal, compile_and_run, ['-package containers']) test('T5719', normal, compile_and_run, ['']) +test('T11465a', normal, compile_and_run, [''])
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_run/KindInvariant.script b/testsuite/tests/typecheck/should_run/KindInvariant.script new file mode 100644 index 0000000000..a993d515c5 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/KindInvariant.script @@ -0,0 +1,12 @@ +:set -XTypeInType -XDataKinds -XKindSignatures -XMagicHash -XPolyKinds +:m + Data.Kind GHC.Exts + +data T (a :: k -> k') +:kind T State# + +data T (a :: * -> k') +:kind T State# + +-- this should fail +data T (a :: * -> *) +:kind T State# diff --git a/testsuite/tests/typecheck/should_run/KindInvariant.stderr b/testsuite/tests/typecheck/should_run/KindInvariant.stderr new file mode 100644 index 0000000000..777b802415 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/KindInvariant.stderr @@ -0,0 +1,5 @@ + +<interactive>:1:3: error: + • Expected kind ‘* -> *’, but ‘State#’ has kind ‘* -> #’ + • In the first argument of ‘T’, namely ‘State#’ + In the type ‘T State#’ diff --git a/testsuite/tests/typecheck/should_run/KindInvariant.stdout b/testsuite/tests/typecheck/should_run/KindInvariant.stdout new file mode 100644 index 0000000000..d7cbaed9e1 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/KindInvariant.stdout @@ -0,0 +1,2 @@ +T State# :: * +T State# :: * diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 79bf208c57..a9f973f9ff 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -114,4 +114,5 @@ test('T10284', exit_code(1), compile_and_run, ['']) test('T11049', exit_code(1), compile_and_run, ['']) test('T11230', normal, compile_and_run, ['']) test('TypeOf', normal, compile_and_run, ['']) -test('T11120', normal, compile_and_run, [''])
\ No newline at end of file +test('T11120', normal, compile_and_run, ['']) +test('KindInvariant', normal, ghci_script, ['KindInvariant.script'])
\ No newline at end of file |