[commit: ghc] ghc-8.0: Add tests for #11465 and the kind invariant (b0fd23b)

git at git.haskell.org git at git.haskell.org
Mon Jul 25 18:37:14 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/b0fd23b58e4e194a7f65d0f42ca0e0e18c1c7e17/ghc

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

commit b0fd23b58e4e194a7f65d0f42ca0e0e18c1c7e17
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
    
    (cherry picked from commit 2df422161bccf7c0fad97e468085ebab1a17e19e)


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

b0fd23b58e4e194a7f65d0f42ca0e0e18c1c7e17
 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   |  6 ++++++
 .../tests/typecheck/should_run/KindInvariant.stdout   |  2 ++
 6 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..d3626cf
--- /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 'WordRep) 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..3fe8131
--- /dev/null
+++ b/testsuite/tests/typecheck/should_run/KindInvariant.stderr
@@ -0,0 +1,6 @@
+
+<interactive>:1:3: error:
+    • Expected kind ‘* -> *’,
+        but ‘State#’ has kind ‘* -> TYPE 'VoidRep’
+    • 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# :: *



More information about the ghc-commits mailing list