[commit: ghc] master: Add tests for #11465 and the kind invariant (2df4221)

git at git.haskell.org git at git.haskell.org
Fri Jan 22 13:20:22 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2df422161bccf7c0fad97e468085ebab1a17e19e/ghc

>---------------------------------------------------------------

commit 2df422161bccf7c0fad97e468085ebab1a17e19e
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Fri Jan 22 13:01:55 2016 +0100

    Add tests for #11465 and the kind invariant


>---------------------------------------------------------------

2df422161bccf7c0fad97e468085ebab1a17e19e
 testsuite/tests/indexed-types/should_run/T11465a.hs   | 19 +++++++++++++++++++
 .../tests/indexed-types/should_run/T11465a.stdout     |  1 +
 testsuite/tests/indexed-types/should_run/all.T        |  1 +
 .../tests/typecheck/should_run/KindInvariant.script   | 12 ++++++++++++
 .../tests/typecheck/should_run/KindInvariant.stderr   |  5 +++++
 .../tests/typecheck/should_run/KindInvariant.stdout   |  2 ++
 testsuite/tests/typecheck/should_run/all.T            |  1 +
 7 files changed, 41 insertions(+)

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 0000000..41fc197
--- /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 0000000..4076583
--- /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 f5c8c5c..8d72c46 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 0000000..a993d51
--- /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 0000000..777b802
--- /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 0000000..d7cbaed
--- /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 79bf208..a9f973f 100755
--- a/testsuite/tests/typecheck/should_run/all.T
+++ b/testsuite/tests/typecheck/should_run/all.T
@@ -115,3 +115,4 @@ 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, [''])
+test('KindInvariant', normal, ghci_script, ['KindInvariant.script'])
\ No newline at end of file



More information about the ghc-commits mailing list