summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-05-02 12:19:56 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-05 03:24:53 -0400
commit2420c555e6cb681f4ef7c4ae3192a850ab431759 (patch)
tree42625edf1093129104aa1c0e3c1e838bb787f287 /testsuite/tests/polykinds
parent3c862f635394b02c121f917a4d9ea7802033eebb (diff)
downloadhaskell-2420c555e6cb681f4ef7c4ae3192a850ab431759.tar.gz
Add regression tests for #16244, #16245, #16758
Commit e3c374cc5bd7eb49649b9f507f9f7740697e3f70 ended up fixing quite a few bugs: * This commit fixes #16244 completely. A regression test has been added. * This commit fixes one program from #16245. (The program in https://gitlab.haskell.org/ghc/ghc/issues/16245#note_211369 still panics, and the program in https://gitlab.haskell.org/ghc/ghc/issues/16245#note_211400 still loops infinitely.) A regression test has been added for this program. * This commit fixes #16758. Accordingly, this patch removes the `expect_broken` label from the `T16758` test case, moves it from `should_compile` to `should_fail` (as it should produce an error message), and checks in the expected stderr.
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r--testsuite/tests/polykinds/T16244.hs11
-rw-r--r--testsuite/tests/polykinds/T16244.stderr11
-rw-r--r--testsuite/tests/polykinds/T16245.hs11
-rw-r--r--testsuite/tests/polykinds/T16245.stderr11
-rw-r--r--testsuite/tests/polykinds/all.T2
5 files changed, 46 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T16244.hs b/testsuite/tests/polykinds/T16244.hs
new file mode 100644
index 0000000000..dbcb5232b4
--- /dev/null
+++ b/testsuite/tests/polykinds/T16244.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE PolyKinds #-}
+module T16244 where
+
+import Data.Kind
+
+type Const a b = a
+type SameKind (a :: k) (b :: k) = (() :: Constraint)
+class SameKind a b => C (k :: Const Type a) (b :: k)
diff --git a/testsuite/tests/polykinds/T16244.stderr b/testsuite/tests/polykinds/T16244.stderr
new file mode 100644
index 0000000000..d261a70ba3
--- /dev/null
+++ b/testsuite/tests/polykinds/T16244.stderr
@@ -0,0 +1,11 @@
+
+T16244.hs:11:18: error:
+ • Couldn't match kind ‘k1’ with ‘k’
+ ‘k1’ is a rigid type variable bound by
+ the class declaration for ‘C’
+ at T16244.hs:11:26
+ ‘k’ is a rigid type variable bound by
+ the class declaration for ‘C’
+ at T16244.hs:11:1-52
+ • In the second argument of ‘SameKind’, namely ‘b’
+ In the class declaration for ‘C’
diff --git a/testsuite/tests/polykinds/T16245.hs b/testsuite/tests/polykinds/T16245.hs
new file mode 100644
index 0000000000..8fcd38cb77
--- /dev/null
+++ b/testsuite/tests/polykinds/T16245.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE QuantifiedConstraints #-}
+module T16245 where
+
+import Data.Kind
+
+type Const a b = a
+type SameKind (a :: k) (b :: k) = (() :: Constraint)
+class (forall (b :: k). SameKind a b) => C (k :: Const Type a)
diff --git a/testsuite/tests/polykinds/T16245.stderr b/testsuite/tests/polykinds/T16245.stderr
new file mode 100644
index 0000000000..e478fe4e5f
--- /dev/null
+++ b/testsuite/tests/polykinds/T16245.stderr
@@ -0,0 +1,11 @@
+
+T16245.hs:11:36: error:
+ • Couldn't match kind ‘k1’ with ‘k’
+ ‘k1’ is a rigid type variable bound by
+ the class declaration for ‘C’
+ at T16245.hs:11:45
+ ‘k’ is a rigid type variable bound by
+ the class declaration for ‘C’
+ at T16245.hs:11:1-62
+ • In the second argument of ‘SameKind’, namely ‘b’
+ In the class declaration for ‘C’
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index f77af8972c..87ee448e32 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -211,6 +211,8 @@ test('T16247a', normal, compile_fail, [''])
test('KindVarOrder', normal, ghci_script, ['KindVarOrder.script'])
test('T16221', normal, compile, [''])
test('T16221a', normal, compile_fail, [''])
+test('T16244', normal, compile_fail, [''])
+test('T16245', normal, compile_fail, [''])
test('T16342', normal, compile, [''])
test('T16263', normal, compile_fail, [''])
test('T16902', normal, compile_fail, [''])