summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-03-26 16:10:51 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2020-03-26 16:10:53 -0400
commit41f2c0cf020d5138acba5fc4519364fdb3b5fbe1 (patch)
treefd7159226c77c0b308b196d8a37f9d315d86ff69
parent6d172e63f3dd3590b0a57371efb8f924f1fcdf05 (diff)
downloadhaskell-wip/T17963.tar.gz
Add regression test for #17963wip/T17963
The panic in #17963 happened to be fixed by commit e3c374cc5bd7eb49649b9f507f9f7740697e3f70. This patch adds a regression test to ensure that it remains fixed. Fixes #17963.
-rw-r--r--testsuite/tests/polykinds/T17963.hs15
-rw-r--r--testsuite/tests/polykinds/T17963.stderr13
-rw-r--r--testsuite/tests/polykinds/all.T1
3 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T17963.hs b/testsuite/tests/polykinds/T17963.hs
new file mode 100644
index 0000000000..ed609384d6
--- /dev/null
+++ b/testsuite/tests/polykinds/T17963.hs
@@ -0,0 +1,15 @@
+{-# Language DataKinds #-}
+{-# Language PolyKinds #-}
+{-# Language RankNTypes #-}
+{-# Language StandaloneKindSignatures #-}
+{-# Language TypeApplications #-}
+module T17963 where
+
+import GHC.Types (Constraint, Type, TYPE, RuntimeRep(..))
+
+type Cat :: forall (rep :: RuntimeRep). TYPE rep -> Type
+type Cat ob = ob -> ob -> Type
+
+type Category' :: forall rep (ob :: TYPE rep). Cat @rep ob -> Constraint
+class Category' (cat :: Cat @rep ob) where
+ id' :: forall a. cat a a
diff --git a/testsuite/tests/polykinds/T17963.stderr b/testsuite/tests/polykinds/T17963.stderr
new file mode 100644
index 0000000000..84201e0de4
--- /dev/null
+++ b/testsuite/tests/polykinds/T17963.stderr
@@ -0,0 +1,13 @@
+
+T17963.hs:15:23: error:
+ • Couldn't match a lifted type with an unlifted type
+ ‘rep1’ is a rigid type variable bound by
+ the class declaration for ‘Category'’
+ at T17963.hs:13:27-29
+ When matching kinds
+ k0 :: *
+ ob :: TYPE rep1
+ Expected kind ‘ob’, but ‘a’ has kind ‘k0’
+ • In the first argument of ‘cat’, namely ‘a’
+ In the type signature: id' :: forall a. cat a a
+ In the class declaration for ‘Category'’
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index 454be6fc62..f77af8972c 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -216,3 +216,4 @@ test('T16263', normal, compile_fail, [''])
test('T16902', normal, compile_fail, [''])
test('CuskFam', normal, compile, [''])
test('T17841', normal, compile_fail, [''])
+test('T17963', normal, compile_fail, [''])