summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-05-02 12:19:56 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2020-05-02 15:12:12 -0400
commit01dd8c760a2662400e9d1d9f6fd41f320b90721b (patch)
tree18c25a545d4c444df76b87f50f0fbc6a9532bc31
parentfd7ea0fee92a60f9658254cc4fe3abdb4ff299b1 (diff)
downloadhaskell-wip/T16758.tar.gz
Add regression tests for #16244, #16245, #16758wip/T16758
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.
-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
-rw-r--r--testsuite/tests/saks/should_compile/all.T1
-rw-r--r--testsuite/tests/saks/should_fail/T16758.hs (renamed from testsuite/tests/saks/should_compile/T16758.hs)0
-rw-r--r--testsuite/tests/saks/should_fail/T16758.stderr8
-rw-r--r--testsuite/tests/saks/should_fail/all.T1
9 files changed, 55 insertions, 1 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, [''])
diff --git a/testsuite/tests/saks/should_compile/all.T b/testsuite/tests/saks/should_compile/all.T
index 73f608c6dd..d1fc603a73 100644
--- a/testsuite/tests/saks/should_compile/all.T
+++ b/testsuite/tests/saks/should_compile/all.T
@@ -34,7 +34,6 @@ test('T16723', normal, compile, [''])
test('T16724', extra_files(['T16724.hs']), ghci_script, ['T16724.script'])
test('T16726', normal, compile, [''])
test('T16731', normal, compile, [''])
-test('T16758', expect_broken(16758), compile, [''])
test('T16721', normal, ghci_script, ['T16721.script'])
test('T16756a', normal, compile, [''])
diff --git a/testsuite/tests/saks/should_compile/T16758.hs b/testsuite/tests/saks/should_fail/T16758.hs
index 2798156f3c..2798156f3c 100644
--- a/testsuite/tests/saks/should_compile/T16758.hs
+++ b/testsuite/tests/saks/should_fail/T16758.hs
diff --git a/testsuite/tests/saks/should_fail/T16758.stderr b/testsuite/tests/saks/should_fail/T16758.stderr
new file mode 100644
index 0000000000..f74241a706
--- /dev/null
+++ b/testsuite/tests/saks/should_fail/T16758.stderr
@@ -0,0 +1,8 @@
+
+T16758.hs:14:8: error:
+ • Couldn't match expected kind ‘Int’ with actual kind ‘a’
+ ‘a’ is a rigid type variable bound by
+ the class declaration for ‘C’
+ at T16758.hs:12:19
+ • In the type signature: f :: C a => a -> Int
+ In the class declaration for ‘C’
diff --git a/testsuite/tests/saks/should_fail/all.T b/testsuite/tests/saks/should_fail/all.T
index 82ae24181c..d2722fb9c4 100644
--- a/testsuite/tests/saks/should_fail/all.T
+++ b/testsuite/tests/saks/should_fail/all.T
@@ -30,3 +30,4 @@ test('T16727b', normal, compile_fail, [''])
test('T16725', normal, compile_fail, [''])
test('T16826', normal, compile_fail, [''])
test('T16756b', normal, compile_fail, [''])
+test('T16758', normal, compile_fail, [''])