summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-03-26 16:10:51 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-31 10:54:57 -0400
commit33f095511a8fce4c945bbcd4feb3910c854dcb61 (patch)
tree0ea4de3aeafb11096d573a982b257c47910a0b47
parent57b888c0e90be7189285a6b078c30b26d0923809 (diff)
downloadhaskell-33f095511a8fce4c945bbcd4feb3910c854dcb61.tar.gz
Add regression test for #17963
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, [''])