summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2018-11-28 16:06:15 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2018-11-29 17:27:40 +0000
commit2257a86daa72db382eb927df12a718669d5491f8 (patch)
tree74bc33c17a5c898764be09eb6a9cb33572e91b2d /testsuite/tests/polykinds
parent79d5427e1f9de02c0b171bf5db46b6b49c6f85e3 (diff)
downloadhaskell-2257a86daa72db382eb927df12a718669d5491f8.tar.gz
Taming the Kind Inference Monster
My original goal was (Trac #15809) to move towards using level numbers as the basis for deciding which type variables to generalise, rather than searching for the free varaibles of the environment. However it has turned into a truly major refactoring of the kind inference engine. Let's deal with the level-numbers part first: * Augment quantifyTyVars to calculate the type variables to quantify using level numbers, and compare the result with the existing approach. That is; no change in behaviour, just a WARNing if the two approaches give different answers. * To do this I had to get the level number right when calling quantifyTyVars, and this entailed a bit of care, especially in the code for kind-checking type declarations. * However, on the way I was able to eliminate or simplify a number of calls to solveEqualities. This work is incomplete: I'm not /using/ level numbers yet. When I subsequently get rid of any remaining WARNings in quantifyTyVars, that the level-number answers differ from the current answers, then I can rip out the current "free vars of the environment" stuff. Anyway, this led me into deep dive into kind inference for type and class declarations, which is an increasingly soggy part of GHC. Richard already did some good work recently in commit 5e45ad10ffca1ad175b10f6ef3327e1ed8ba25f3 Date: Thu Sep 13 09:56:02 2018 +0200 Finish fix for #14880. The real change that fixes the ticket is described in Note [Naughty quantification candidates] in TcMType. but I kept turning over stones. So this patch has ended up with a pretty significant refactoring of that code too. Kind inference for types and classes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Major refactoring in the way we generalise the inferred kind of a TyCon, in kcTyClGroup. Indeed, I made it into a new top-level function, generaliseTcTyCon. Plus a new Note to explain it Note [Inferring kinds for type declarations]. * We decided (Trac #15592) not to treat class type variables specially when dealing with Inferred/Specified/Required for associated types. That simplifies things quite a bit. I also rewrote Note [Required, Specified, and Inferred for types] * Major refactoring of the crucial function kcLHsQTyVars: I split it into kcLHsQTyVars_Cusk and kcLHsQTyVars_NonCusk because the two are really quite different. The CUSK case is almost entirely rewritten, and is much easier because of our new decision not to treat the class variables specially * I moved all the error checks from tcTyClTyVars (which was a bizarre place for it) into generaliseTcTyCon and/or the CUSK case of kcLHsQTyVars. Now tcTyClTyVars is extremely simple. * I got rid of all the all the subtleties in tcImplicitTKBndrs. Indeed now there is no difference between tcImplicitTKBndrs and kcImplicitTKBndrs; there is now a single bindImplicitTKBndrs. Same for kc/tcExplicitTKBndrs. None of them monkey with level numbers, nor build implication constraints. scopeTyVars is gone entirely, as is kcLHsQTyVarBndrs. It's vastly simpler. I found I could get rid of kcLHsQTyVarBndrs entirely, in favour of the bnew bindExplicitTKBndrs. Quantification ~~~~~~~~~~~~~~ * I now deal with the "naughty quantification candidates" of the previous patch in candidateQTyVars, rather than in quantifyTyVars; see Note [Naughty quantification candidates] in TcMType. I also killed off closeOverKindsCQTvs in favour of the same strategy that we use for tyCoVarsOfType: namely, close over kinds at the occurrences. And candidateQTyVars no longer needs a gbl_tvs argument. * Passing the ContextKind, rather than the expected kind itself, to tc_hs_sig_type_and_gen makes it easy to allocate the expected result kind (when we are in inference mode) at the right level. Type families ~~~~~~~~~~~~~~ * I did a major rewrite of the impenetrable tcFamTyPats. The result is vastly more comprehensible. * I got rid of kcDataDefn entirely, quite a big function. * I re-did the way that checkConsistentFamInst works, so that it allows alpha-renaming of invisible arguments. * The interaction of kind signatures and family instances is tricky. Type families: see Note [Apparently-nullary families] Data families: see Note [Result kind signature for a data family instance] and Note [Eta-reduction for data families] * The consistent instantation of an associated type family is tricky. See Note [Checking consistent instantiation] and Note [Matching in the consistent-instantation check] in TcTyClsDecls. It's now checked in TcTyClsDecls because that is when we have the relevant info to hand. * I got tired of the compromises in etaExpandFamInst, so I did the job properly by adding a field cab_eta_tvs to CoAxBranch. See Coercion.etaExpandCoAxBranch. tcInferApps and friends ~~~~~~~~~~~~~~~~~~~~~~~ * I got rid of the mysterious and horrible ClsInstInfo argument to tcInferApps, checkExpectedKindX, and various checkValid functions. It was horrible! * I got rid of [Type] result of tcInferApps. This list was used only in tcFamTyPats, when checking the LHS of a type instance; and if there is a cast in the middle, the list is meaningless. So I made tcInferApps simpler, and moved the complexity (not much) to tcInferApps. Result: tcInferApps is now pretty comprehensible again. * I refactored the many function in TcMType that instantiate skolems. Smaller things * I rejigged the error message in checkValidTelescope; I think it's quite a bit better now. * checkValidType was not rejecting constraints in a kind signature forall (a :: Eq b => blah). blah2 That led to further errors when we then do an ambiguity check. So I make checkValidType reject it more aggressively. * I killed off quantifyConDecl, instead calling kindGeneralize directly. * I fixed an outright bug in tyCoVarsOfImplic, where we were not colleting the tyvar of the kind of the skolems * Renamed ClsInstInfo to AssocInstInfo, and made it into its own data type * Some fiddling around with pretty-printing of family instances which was trickier than I thought. I wanted wildcards to print as plain "_" in user messages, although they each need a unique identity in the CoAxBranch. Some other oddments * Refactoring around the trace messages from reportUnsolved. * A bit of extra tc-tracing in TcHsSyn.commitFlexi This patch fixes a raft of bugs, and includes tests for them. * #14887 * #15740 * #15764 * #15789 * #15804 * #15817 * #15870 * #15874 * #15881
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r--testsuite/tests/polykinds/T11203.stderr2
-rw-r--r--testsuite/tests/polykinds/T11821a.stderr2
-rw-r--r--testsuite/tests/polykinds/T12593.stderr8
-rw-r--r--testsuite/tests/polykinds/T13985.hs1
-rw-r--r--testsuite/tests/polykinds/T13985.stderr41
-rw-r--r--testsuite/tests/polykinds/T14450.stderr11
-rw-r--r--testsuite/tests/polykinds/T14846.stderr36
-rw-r--r--testsuite/tests/polykinds/T14887a.hs16
-rw-r--r--testsuite/tests/polykinds/T14887a.stderr1
-rw-r--r--testsuite/tests/polykinds/T15592.stderr2
-rw-r--r--testsuite/tests/polykinds/T15592b.stderr4
-rw-r--r--testsuite/tests/polykinds/T15789.hs10
-rw-r--r--testsuite/tests/polykinds/T15789.stderr6
-rw-r--r--testsuite/tests/polykinds/T15804.hs5
-rw-r--r--testsuite/tests/polykinds/T15804.stderr4
-rw-r--r--testsuite/tests/polykinds/T15817.hs10
-rw-r--r--testsuite/tests/polykinds/T15874.hs18
-rw-r--r--testsuite/tests/polykinds/T15881.hs8
-rw-r--r--testsuite/tests/polykinds/T15881.stderr5
-rw-r--r--testsuite/tests/polykinds/T15881a.hs8
-rw-r--r--testsuite/tests/polykinds/T15881a.stderr4
-rw-r--r--testsuite/tests/polykinds/T8616.stderr9
-rw-r--r--testsuite/tests/polykinds/all.T7
23 files changed, 162 insertions, 56 deletions
diff --git a/testsuite/tests/polykinds/T11203.stderr b/testsuite/tests/polykinds/T11203.stderr
index 5d62e00304..f5c72133ae 100644
--- a/testsuite/tests/polykinds/T11203.stderr
+++ b/testsuite/tests/polykinds/T11203.stderr
@@ -1,4 +1,4 @@
T11203.hs:7:24: error:
• Couldn't match ‘k1’ with ‘k2’
- • In the data declaration for ‘Q’
+ • In the data type declaration for ‘Q’
diff --git a/testsuite/tests/polykinds/T11821a.stderr b/testsuite/tests/polykinds/T11821a.stderr
index 2e443e637b..f55c703524 100644
--- a/testsuite/tests/polykinds/T11821a.stderr
+++ b/testsuite/tests/polykinds/T11821a.stderr
@@ -1,4 +1,4 @@
T11821a.hs:4:31: error:
• Couldn't match ‘k1’ with ‘k2’
- • In the type declaration for ‘SameKind’
+ • In the type synonym declaration for ‘SameKind’
diff --git a/testsuite/tests/polykinds/T12593.stderr b/testsuite/tests/polykinds/T12593.stderr
index 27123a8bc8..e150299ea1 100644
--- a/testsuite/tests/polykinds/T12593.stderr
+++ b/testsuite/tests/polykinds/T12593.stderr
@@ -92,8 +92,8 @@ T12593.hs:14:6: error:
• In the pattern: Free cat
In an equation for ‘run’: run (Free cat) = cat
• Relevant bindings include
- run :: Free k6 k7 k8 p a b
- -> (forall (c :: k6) (d :: k7). p c d -> q c d) -> q a b
+ run :: Free k k4 k8 p a b
+ -> (forall (c :: k) (d :: k4). p c d -> q c d) -> q a b
(bound at T12593.hs:14:1)
T12593.hs:14:18: error:
@@ -111,6 +111,6 @@ T12593.hs:14:18: error:
k2 q =>
(forall (c :: k0) (d :: k1). p0 c d -> q c d) -> q a b
(bound at T12593.hs:14:11)
- run :: Free k6 k7 k8 p a b
- -> (forall (c :: k6) (d :: k7). p c d -> q c d) -> q a b
+ run :: Free k k4 k8 p a b
+ -> (forall (c :: k) (d :: k4). p c d -> q c d) -> q a b
(bound at T12593.hs:14:1)
diff --git a/testsuite/tests/polykinds/T13985.hs b/testsuite/tests/polykinds/T13985.hs
index c0555d8f69..6a844b366e 100644
--- a/testsuite/tests/polykinds/T13985.hs
+++ b/testsuite/tests/polykinds/T13985.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
diff --git a/testsuite/tests/polykinds/T13985.stderr b/testsuite/tests/polykinds/T13985.stderr
index f60314a443..2df92c34da 100644
--- a/testsuite/tests/polykinds/T13985.stderr
+++ b/testsuite/tests/polykinds/T13985.stderr
@@ -1,39 +1,28 @@
-T13985.hs:12:1: error:
- • Kind variable ‘k’ is implicitly bound in data family
- ‘Fam’, but does not appear as the kind of any
- of its type variables. Perhaps you meant
- to bind it explicitly somewhere?
+T13985.hs:13:41: error:
+ • Type variable ‘k’ is mentioned in the RHS,
+ but not bound on the LHS of the family instance
• In the data instance declaration for ‘Fam’
-T13985.hs:15:15: error:
- • Kind variable ‘a’ is implicitly bound in type family
- ‘T’, but does not appear as the kind of any
- of its type variables. Perhaps you meant
- to bind it explicitly somewhere?
+T13985.hs:16:43: error:
+ • Type variable ‘a’ is mentioned in the RHS,
+ but not bound on the LHS of the family instance
• In the type instance declaration for ‘T’
-T13985.hs:22:3: error:
- • Kind variable ‘k’ is implicitly bound in associated data family
- ‘CD’, but does not appear as the kind of any
- of its type variables. Perhaps you meant
- to bind it explicitly somewhere?
+T13985.hs:23:26: error:
+ • Type variable ‘k’ is mentioned in the RHS,
+ but not bound on the LHS of the family instance
• In the data instance declaration for ‘CD’
In the instance declaration for ‘C Type’
-T13985.hs:23:8: error:
- • Kind variable ‘a’ is implicitly bound in associated type family
- ‘CT’, but does not appear as the kind of any
- of its type variables. Perhaps you meant
- to bind it explicitly somewhere?
+T13985.hs:24:37: error:
+ • Type variable ‘a’ is mentioned in the RHS,
+ but not bound on the LHS of the family instance
• In the type instance declaration for ‘CT’
In the instance declaration for ‘C Type’
-T13985.hs:27:3: error:
- • Kind variable ‘x’ is implicitly bound in associated type family
- ‘ZT’, but does not appear as the kind of any
- of its type variables. Perhaps you meant
- to bind it explicitly somewhere?
- Type variables with inferred kinds: (k :: *) (a :: k)
+T13985.hs:28:39: error:
+ • Type variable ‘x’ is mentioned in the RHS,
+ but not bound on the LHS of the family instance
• In the default type instance declaration for ‘ZT’
In the class declaration for ‘Z’
diff --git a/testsuite/tests/polykinds/T14450.stderr b/testsuite/tests/polykinds/T14450.stderr
index 8a987b7a56..107f4aa2ce 100644
--- a/testsuite/tests/polykinds/T14450.stderr
+++ b/testsuite/tests/polykinds/T14450.stderr
@@ -1,8 +1,7 @@
-T14450.hs:33:13: error:
- • Expected kind ‘k ~> k’,
- but ‘IddSym0 :: Type ~> Type’ has kind ‘* ~> *’
- • In the first argument of ‘Dom’, namely
- ‘(IddSym0 :: Type ~> Type)’
- In the type instance declaration for ‘Dom’
+T14450.hs:33:3: error:
+ • Type indexes must match class instance head
+ Expected: Dom @k @k (IddSym0 @k)
+ Actual: Dom @* @* (IddSym0 @*) -- Defined at T14450.hs:33:8
+ • In the type instance declaration for ‘Dom’
In the instance declaration for ‘Varpi (IddSym0 :: k ~> k)’
diff --git a/testsuite/tests/polykinds/T14846.stderr b/testsuite/tests/polykinds/T14846.stderr
index 062dc49e1f..43d81c5e1e 100644
--- a/testsuite/tests/polykinds/T14846.stderr
+++ b/testsuite/tests/polykinds/T14846.stderr
@@ -3,12 +3,8 @@ T14846.hs:38:8: error:
• Couldn't match type ‘ríki’ with ‘Hom riki’
‘ríki’ is a rigid type variable bound by
the type signature for:
- i :: forall k5 k6 (cls2 :: k6
- -> Constraint) (xx :: k5) (a :: Struct cls2) (ríki :: Struct
- cls2
- -> Struct
- cls2
- -> *).
+ i :: forall k5 k6 (cls2 :: k6 -> Constraint) (xx :: k5)
+ (a :: Struct cls2) (ríki :: Struct cls2 -> Struct cls2 -> *).
StructI xx a =>
ríki a a
at T14846.hs:38:8-48
@@ -16,21 +12,31 @@ T14846.hs:38:8: error:
Actual type: Hom riki a a
• When checking that instance signature for ‘i’
is more general than its signature in the class
- Instance sig: forall k1 k2 (cls :: k2
- -> Constraint) (xx :: k1) (a :: Struct cls).
+ Instance sig: forall k1 k2 (cls :: k2 -> Constraint) (xx :: k1)
+ (a :: Struct cls).
StructI xx a =>
Hom riki a a
- Class sig: forall k1 k2 (cls :: k2
- -> Constraint) (xx :: k1) (a :: Struct
- cls) (ríki :: Struct
- cls
- -> Struct
- cls
- -> *).
+ Class sig: forall k1 k2 (cls :: k2 -> Constraint) (xx :: k1)
+ (a :: Struct cls) (ríki :: Struct cls -> Struct cls -> *).
StructI xx a =>
ríki a a
In the instance declaration for ‘Category (Hom riki)’
+T14846.hs:39:12: error:
+ • Couldn't match kind ‘k3’ with ‘Struct cls2’
+ ‘k3’ is a rigid type variable bound by
+ the instance declaration
+ at T14846.hs:37:10-65
+ When matching kinds
+ cls0 :: Struct cls -> Constraint
+ cls1 :: k3 -> Constraint
+ • In the expression: struct :: AStruct (Structured a cls)
+ In the expression: case struct :: AStruct (Structured a cls) of
+ In an equation for ‘i’:
+ i = case struct :: AStruct (Structured a cls) of
+ • Relevant bindings include
+ i :: Hom riki a a (bound at T14846.hs:39:3)
+
T14846.hs:39:31: error:
• Couldn't match kind ‘k3’ with ‘Struct cls2’
‘k3’ is a rigid type variable bound by
diff --git a/testsuite/tests/polykinds/T14887a.hs b/testsuite/tests/polykinds/T14887a.hs
new file mode 100644
index 0000000000..2e5cf02212
--- /dev/null
+++ b/testsuite/tests/polykinds/T14887a.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE PartialTypeSignatures #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeInType #-}
+{-# OPTIONS_GHC -Wno-partial-type-signatures -Wno-implicit-kind-vars #-}
+module Bug where
+
+import Data.Proxy
+
+f1 :: forall (x :: a). Proxy (x :: _)
+-- This one has an implicitly-quantified kind var 'a', which
+-- we will stop accepting in the future, under the forall-or-nothing
+-- rule. Hence -Wno-implicit-kind-vars
+f1 = Proxy
+
+f2 :: forall a (x :: a). Proxy (x :: _)
+f2 = Proxy
diff --git a/testsuite/tests/polykinds/T14887a.stderr b/testsuite/tests/polykinds/T14887a.stderr
new file mode 100644
index 0000000000..0519ecba6e
--- /dev/null
+++ b/testsuite/tests/polykinds/T14887a.stderr
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/testsuite/tests/polykinds/T15592.stderr b/testsuite/tests/polykinds/T15592.stderr
index c1b823e738..4086c12bf6 100644
--- a/testsuite/tests/polykinds/T15592.stderr
+++ b/testsuite/tests/polykinds/T15592.stderr
@@ -1,6 +1,6 @@
TYPE CONSTRUCTORS
type role T nominal nominal representational nominal nominal
- T :: forall {k} k1. (k1 -> k -> *) -> k1 -> k -> *
+ T{5} :: forall {k} k1. (k1 -> k -> *) -> k1 -> k -> *
DATA CONSTRUCTORS
MkT :: forall {k} k1 (f :: k1 -> k -> *) (a :: k1) (b :: k).
f a b -> T f a b -> T f a b
diff --git a/testsuite/tests/polykinds/T15592b.stderr b/testsuite/tests/polykinds/T15592b.stderr
index c51416f4c5..d07b3a1ac7 100644
--- a/testsuite/tests/polykinds/T15592b.stderr
+++ b/testsuite/tests/polykinds/T15592b.stderr
@@ -1,7 +1,7 @@
TYPE CONSTRUCTORS
- C :: forall {k}. k -> Constraint
+ C{2} :: forall {k}. k -> Constraint
type role T nominal nominal nominal nominal
- T :: forall {k} (a :: k) (f :: k -> *). f a -> *
+ T{4} :: forall k (f :: k -> *) (a :: k). f a -> *
Dependent modules: []
Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3,
integer-gmp-1.0.2.0]
diff --git a/testsuite/tests/polykinds/T15789.hs b/testsuite/tests/polykinds/T15789.hs
new file mode 100644
index 0000000000..6465da2a9b
--- /dev/null
+++ b/testsuite/tests/polykinds/T15789.hs
@@ -0,0 +1,10 @@
+{-# Language LiberalTypeSynonyms #-}
+{-# Language PolyKinds #-}
+{-# Language RankNTypes #-}
+{-# Language DataKinds #-}
+
+import Data.Kind
+
+type Cat ob = ob -> ob -> Type
+
+data Zero :: forall (cat :: forall xx. xx -> Type) a. forall b. Cat (forall b. cat b u)
diff --git a/testsuite/tests/polykinds/T15789.stderr b/testsuite/tests/polykinds/T15789.stderr
new file mode 100644
index 0000000000..c0fd4eab34
--- /dev/null
+++ b/testsuite/tests/polykinds/T15789.stderr
@@ -0,0 +1,6 @@
+
+T15789.hs:10:80: error:
+ • Expected kind ‘k2 -> *’, but ‘cat b’ has kind ‘*’
+ • In the first argument of ‘Cat’, namely ‘(forall b. cat b u)’
+ In the kind ‘forall (cat :: forall xx. xx -> Type) a.
+ forall b. Cat (forall b. cat b u)’
diff --git a/testsuite/tests/polykinds/T15804.hs b/testsuite/tests/polykinds/T15804.hs
new file mode 100644
index 0000000000..be5fa165a3
--- /dev/null
+++ b/testsuite/tests/polykinds/T15804.hs
@@ -0,0 +1,5 @@
+{-# Language PolyKinds #-}
+
+module T15804 where
+
+data T :: (a :: k) -> *
diff --git a/testsuite/tests/polykinds/T15804.stderr b/testsuite/tests/polykinds/T15804.stderr
new file mode 100644
index 0000000000..52262b675f
--- /dev/null
+++ b/testsuite/tests/polykinds/T15804.stderr
@@ -0,0 +1,4 @@
+
+T15804.hs:5:12: error:
+ • Expected a type, but ‘a :: k’ has kind ‘k’
+ • In the kind ‘(a :: k) -> *’
diff --git a/testsuite/tests/polykinds/T15817.hs b/testsuite/tests/polykinds/T15817.hs
new file mode 100644
index 0000000000..a5f3eb78db
--- /dev/null
+++ b/testsuite/tests/polykinds/T15817.hs
@@ -0,0 +1,10 @@
+{-# Language RankNTypes #-}
+{-# Language PolyKinds #-}
+{-# Language TypeFamilies #-}
+
+module T15817 where
+
+import Data.Kind
+
+data family X :: forall (a :: Type). Type
+data instance X = MkX
diff --git a/testsuite/tests/polykinds/T15874.hs b/testsuite/tests/polykinds/T15874.hs
new file mode 100644
index 0000000000..fd560db095
--- /dev/null
+++ b/testsuite/tests/polykinds/T15874.hs
@@ -0,0 +1,18 @@
+{-# Language RankNTypes #-}
+{-# Language DataKinds #-}
+{-# Language PolyKinds #-}
+{-# Language GADTs #-}
+{-# Language TypeFamilies #-}
+
+module T15874 where
+
+import Data.Kind
+
+data Var where
+ Op :: Var
+ Id :: Var
+
+type Varianced = (forall (var :: Var). Type)
+
+data family Parser :: Varianced
+data instance Parser = P
diff --git a/testsuite/tests/polykinds/T15881.hs b/testsuite/tests/polykinds/T15881.hs
new file mode 100644
index 0000000000..a49b7fd436
--- /dev/null
+++ b/testsuite/tests/polykinds/T15881.hs
@@ -0,0 +1,8 @@
+{-# Language KindSignatures #-}
+{-# Language PolyKinds #-}
+
+module T15881 where
+
+import Data.Kind
+
+data A n (a :: n n) :: Type
diff --git a/testsuite/tests/polykinds/T15881.stderr b/testsuite/tests/polykinds/T15881.stderr
new file mode 100644
index 0000000000..4fde71dab7
--- /dev/null
+++ b/testsuite/tests/polykinds/T15881.stderr
@@ -0,0 +1,5 @@
+
+T15881.hs:8:18: error:
+ • Occurs check: cannot construct the infinite kind: k0 ~ k0 -> *
+ • In the first argument of ‘n’, namely ‘n’
+ In the kind ‘n n’
diff --git a/testsuite/tests/polykinds/T15881a.hs b/testsuite/tests/polykinds/T15881a.hs
new file mode 100644
index 0000000000..a29c63f706
--- /dev/null
+++ b/testsuite/tests/polykinds/T15881a.hs
@@ -0,0 +1,8 @@
+{-# Language KindSignatures #-}
+{-# Language PolyKinds #-}
+
+module T15881a where
+
+import Data.Kind
+
+data A n (a :: n) :: a -> Type
diff --git a/testsuite/tests/polykinds/T15881a.stderr b/testsuite/tests/polykinds/T15881a.stderr
new file mode 100644
index 0000000000..84014c7abc
--- /dev/null
+++ b/testsuite/tests/polykinds/T15881a.stderr
@@ -0,0 +1,4 @@
+
+T15881a.hs:8:22: error:
+ • Expected a type, but ‘a’ has kind ‘n’
+ • In the kind ‘a -> Type’
diff --git a/testsuite/tests/polykinds/T8616.stderr b/testsuite/tests/polykinds/T8616.stderr
index 9aa4ab50d9..f9e5132a34 100644
--- a/testsuite/tests/polykinds/T8616.stderr
+++ b/testsuite/tests/polykinds/T8616.stderr
@@ -13,3 +13,12 @@ T8616.hs:8:16: error:
withSomeSing = undefined :: (Any :: k)
• Relevant bindings include
withSomeSing :: Proxy kproxy (bound at T8616.hs:8:1)
+
+T8616.hs:8:30: error:
+ • Expected a type, but ‘Any :: k’ has kind ‘k’
+ • In an expression type signature: (Any :: k)
+ In the expression: undefined :: (Any :: k)
+ In an equation for ‘withSomeSing’:
+ withSomeSing = undefined :: (Any :: k)
+ • Relevant bindings include
+ withSomeSing :: Proxy kproxy (bound at T8616.hs:8:1)
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index 6ffb3181ce..8be2c59bf0 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -196,3 +196,10 @@ test('T15577', normal, compile_fail, ['-O'])
test('T15592', normal, compile, [''])
test('T15592b', normal, compile, ['-ddump-types -fprint-explicit-foralls'])
test('T15787', normal, compile_fail, [''])
+test('T15789', normal, compile_fail, [''])
+test('T15804', normal, compile_fail, [''])
+test('T15881', normal, compile_fail, [''])
+test('T15881a', normal, compile_fail, [''])
+test('T15817', normal, compile, [''])
+test('T15874', normal, compile, [''])
+test('T14887a', normal, compile, [''])