diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-05-02 12:19:56 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-05-05 03:24:53 -0400 |
commit | 2420c555e6cb681f4ef7c4ae3192a850ab431759 (patch) | |
tree | 42625edf1093129104aa1c0e3c1e838bb787f287 /testsuite | |
parent | 3c862f635394b02c121f917a4d9ea7802033eebb (diff) | |
download | haskell-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')
-rw-r--r-- | testsuite/tests/polykinds/T16244.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T16244.stderr | 11 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T16245.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T16245.stderr | 11 | ||||
-rw-r--r-- | testsuite/tests/polykinds/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/saks/should_compile/all.T | 1 | ||||
-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.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/saks/should_fail/all.T | 1 |
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, ['']) |