summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-01-10 12:30:27 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-01-11 19:41:28 -0500
commitaddf8e544841a3f7c818331e47fa89a2cbfb7b29 (patch)
tree39c9975cbefcdaba64d09bf236f100948ed5f129 /testsuite/tests/typecheck/should_fail
parentc6300cb319f5d756e4addf8193b8115949e645ac (diff)
downloadhaskell-addf8e544841a3f7c818331e47fa89a2cbfb7b29.tar.gz
Kind TyCons: require KindSignatures, not DataKinds
Uses of a TyCon in a kind signature required users to enable DataKinds, which didn't make much sense, e.g. in type U = Type type MyMaybe (a :: U) = MyNothing | MyJust a Now the DataKinds error is restricted to data constructors; the use of kind-level type constructors is instead gated behind -XKindSignatures. This patch also adds a convenience pattern synonym for patching on both a TyCon or a TcTyCon stored in a TcTyThing, used in tcTyVar and tc_infer_id. fixes #20873
Diffstat (limited to 'testsuite/tests/typecheck/should_fail')
-rw-r--r--testsuite/tests/typecheck/should_fail/T20873c.hs11
-rw-r--r--testsuite/tests/typecheck/should_fail/T20873c.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T1
3 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T20873c.hs b/testsuite/tests/typecheck/should_fail/T20873c.hs
new file mode 100644
index 0000000000..776c061f13
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T20873c.hs
@@ -0,0 +1,11 @@
+
+{-# LANGUAGE GADTSyntax, NoKindSignatures, NoDataKinds #-}
+
+module T20873c where
+
+import Data.Kind ( Type )
+
+type U a = Type
+
+data Foo :: U Int where
+ MkFoo :: Foo
diff --git a/testsuite/tests/typecheck/should_fail/T20873c.stderr b/testsuite/tests/typecheck/should_fail/T20873c.stderr
new file mode 100644
index 0000000000..972d01c583
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T20873c.stderr
@@ -0,0 +1,5 @@
+
+T20873c.hs:10:1: error:
+ • Illegal kind signature ‘Foo’
+ (Use KindSignatures to allow kind signatures)
+ • In the data declaration for ‘Foo’
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 908edcfe27..ff092df478 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -628,3 +628,4 @@ test('T20542', normal, compile_fail, [''])
test('T20588', [extra_files(['T20588.hs', 'T20588.hs-boot', 'T20588_aux.hs'])], multimod_compile_fail, ['T20588_aux.hs', '-v0'])
test('T20588c', [extra_files(['T20588c.hs', 'T20588c.hs-boot', 'T20588c_aux.hs'])], multimod_compile_fail, ['T20588c_aux.hs', '-v0'])
test('T20189', normal, compile_fail, [''])
+test('T20873c', normal, compile_fail, [''])