summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Schmits <git@tryp.io>2023-03-17 19:00:05 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-03-22 15:31:18 -0400
commitcedf9a3b7a74a7c1c09e8b994edc40a2447dae08 (patch)
tree2f99f3943b03210009e143089c3346465e842d9e
parente0b8eaf3fc3d2ebbdcc86610b889930dbe5b4cdb (diff)
downloadhaskell-cedf9a3b7a74a7c1c09e8b994edc40a2447dae08.tar.gz
Add structured error messages for GHC.Tc.Utils.TcMType
Tracking ticket: #20119 MR: !10138 This converts uses of `mkTcRnUnknownMessage` to newly added constructors of `TcRnMessage`.
-rw-r--r--compiler/GHC/Tc/Errors/Ppr.hs58
-rw-r--r--compiler/GHC/Tc/Errors/Types.hs44
-rw-r--r--compiler/GHC/Tc/Gen/HsType.hs7
-rw-r--r--compiler/GHC/Tc/TyCl.hs35
-rw-r--r--compiler/GHC/Tc/TyCl/PatSyn.hs8
-rw-r--r--compiler/GHC/Tc/Utils/TcMType.hs34
-rw-r--r--compiler/GHC/Types/Error/Codes.hs3
-rw-r--r--testsuite/tests/dependent/should_fail/T11334b.stderr6
-rw-r--r--testsuite/tests/dependent/should_fail/T14880-2.stderr2
-rw-r--r--testsuite/tests/dependent/should_fail/T14880.stderr2
-rw-r--r--testsuite/tests/dependent/should_fail/T15076.stderr2
-rw-r--r--testsuite/tests/dependent/should_fail/T15076b.stderr2
-rw-r--r--testsuite/tests/dependent/should_fail/T15825.stderr2
-rw-r--r--testsuite/tests/patsyn/should_fail/T14552.stderr2
-rw-r--r--testsuite/tests/patsyn/should_fail/T21479.stderr2
-rw-r--r--testsuite/tests/polykinds/T15795.stderr2
-rw-r--r--testsuite/tests/polykinds/T15795a.stderr2
-rw-r--r--testsuite/tests/typecheck/no_skolem_info/T14040A.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T14350.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T15474.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T15807.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T16946.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T17301.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/T17562.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T17567.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T17567StupidTheta.stderr2
26 files changed, 152 insertions, 82 deletions
diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs
index 3de952f2d8..432163d6f1 100644
--- a/compiler/GHC/Tc/Errors/Ppr.hs
+++ b/compiler/GHC/Tc/Errors/Ppr.hs
@@ -40,7 +40,7 @@ import GHC.Core.FamInstEnv ( FamInst(..), famInstAxiom, pprFamInst )
import GHC.Core.InstEnv
import GHC.Core.TyCo.Rep (Type(..))
import GHC.Core.TyCo.Ppr (pprWithExplicitKindsWhen,
- pprSourceTyCon, pprTyVars, pprWithTYPE)
+ pprSourceTyCon, pprTyVars, pprWithTYPE, pprTyVar, pprTidiedType)
import GHC.Core.PatSyn ( patSynName, pprPatSynType )
import GHC.Core.Predicate
import GHC.Core.Type
@@ -1453,6 +1453,34 @@ instance Diagnostic TcRnMessage where
TcRnTyThingUsedWrong sort thing name
-> mkSimpleDecorated $
pprTyThingUsedWrong sort thing name
+ TcRnCannotDefaultKindVar var knd ->
+ mkSimpleDecorated $
+ (vcat [ text "Cannot default kind variable" <+> quotes (ppr var)
+ , text "of kind:" <+> ppr knd
+ , text "Perhaps enable PolyKinds or add a kind signature" ])
+ TcRnUninferrableTyvar tidied_tvs context ->
+ mkSimpleDecorated $
+ pprWithExplicitKindsWhen True $
+ vcat [ text "Uninferrable type variable"
+ <> plural tidied_tvs
+ <+> pprWithCommas pprTyVar tidied_tvs
+ <+> text "in"
+ , pprUninferrableTyvarCtx context ]
+ TcRnSkolemEscape escapees tv orig_ty ->
+ mkSimpleDecorated $
+ pprWithExplicitKindsWhen True $
+ vcat [ sep [ text "Cannot generalise type; skolem" <> plural escapees
+ , quotes $ pprTyVars escapees
+ , text "would escape" <+> itsOrTheir escapees <+> text "scope"
+ ]
+ , sep [ text "if I tried to quantify"
+ , pprTyVar tv
+ , text "in this type:"
+ ]
+ , nest 2 (pprTidiedType orig_ty)
+ , text "(Indeed, I sometimes struggle even printing this correctly,"
+ , text " due to its ill-scoped nature.)"
+ ]
diagnosticReason = \case
TcRnUnknownMessage m
@@ -1931,6 +1959,12 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnTyThingUsedWrong{}
-> ErrorWithoutFlag
+ TcRnCannotDefaultKindVar{}
+ -> ErrorWithoutFlag
+ TcRnUninferrableTyvar{}
+ -> ErrorWithoutFlag
+ TcRnSkolemEscape{}
+ -> ErrorWithoutFlag
diagnosticHints = \case
TcRnUnknownMessage m
@@ -2427,6 +2461,12 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnTyThingUsedWrong{}
-> noHints
+ TcRnCannotDefaultKindVar{}
+ -> noHints
+ TcRnUninferrableTyvar{}
+ -> noHints
+ TcRnSkolemEscape{}
+ -> noHints
diagnosticCode = constructorCode
@@ -4505,3 +4545,19 @@ pprStageCheckReason = \case
text "instance for" <+> quotes (ppr t)
StageCheckSplice t ->
quotes (ppr t)
+
+pprUninferrableTyvarCtx :: UninferrableTyvarCtx -> SDoc
+pprUninferrableTyvarCtx = \case
+ UninfTyCtx_ClassContext theta ->
+ sep [ text "the class context:", pprTheta theta ]
+ UninfTyCtx_DataContext theta ->
+ sep [ text "the datatype context:", pprTheta theta ]
+ UninfTyCtx_ProvidedContext theta ->
+ sep [ text "the provided context:" , pprTheta theta ]
+ UninfTyCtx_TyfamRhs rhs_ty ->
+ sep [ text "the type family equation right-hand side:" , ppr rhs_ty ]
+ UninfTyCtx_TysynRhs rhs_ty ->
+ sep [ text "the type synonym right-hand side:" , ppr rhs_ty ]
+ UninfTyCtx_Sig exp_kind full_hs_ty ->
+ hang (text "the kind" <+> ppr exp_kind) 2
+ (text "of the type signature:" <+> ppr full_hs_ty)
diff --git a/compiler/GHC/Tc/Errors/Types.hs b/compiler/GHC/Tc/Errors/Types.hs
index aa43f6f581..d84aca8146 100644
--- a/compiler/GHC/Tc/Errors/Types.hs
+++ b/compiler/GHC/Tc/Errors/Types.hs
@@ -94,6 +94,7 @@ module GHC.Tc.Errors.Types (
, HsigShapeMismatchReason(..)
, WrongThingSort(..)
, StageCheckReason(..)
+ , UninferrableTyvarCtx(..)
) where
import GHC.Prelude
@@ -3257,6 +3258,41 @@ data TcRnMessage where
-> !Name -- ^ Name of the thing used wrongly.
-> TcRnMessage
+ {-| TcRnCannotDefaultKindVar is an error that occurs when attempting to use
+ unconstrained kind variables whose type isn't @Type@, without -XPolyKinds.
+
+ Test cases:
+ T11334b
+ -}
+ TcRnCannotDefaultKindVar
+ :: !TyVar -- ^ The unconstrained variable.
+ -> !Kind -- ^ Kind of the variable.
+ -> TcRnMessage
+
+ {-| TcRnUninferrableTyvar is an error that occurs when metavariables
+ in a type could not be defaulted.
+
+ Test cases:
+ T17301, T17562, T17567, T17567StupidTheta, T15474, T21479
+ -}
+ TcRnUninferrableTyvar
+ :: ![TyCoVar] -- ^ The variables that could not be defaulted.
+ -> !UninferrableTyvarCtx -- ^ Description of the surrounding context.
+ -> TcRnMessage
+
+ {-| TcRnSkolemEscape is an error that occurs when type variables from an
+ outer scope is used in a context where they should be locally scoped.
+
+ Test cases:
+ T15076, T15076b, T14880-2, T15825, T14880, T15807, T16946, T14350,
+ T14040A, T15795, T15795a, T14552
+ -}
+ TcRnSkolemEscape
+ :: ![TcTyVar] -- ^ The variables that would escape.
+ -> !TcTyVar -- ^ The variable that is being quantified.
+ -> !Type -- ^ The type in which they occur.
+ -> TcRnMessage
+
deriving Generic
-- | Things forbidden in @type data@ declarations.
@@ -4538,3 +4574,11 @@ data WrongThingSort
data StageCheckReason
= StageCheckInstance !InstanceWhat !PredType
| StageCheckSplice !Name
+
+data UninferrableTyvarCtx
+ = UninfTyCtx_ClassContext [TcType]
+ | UninfTyCtx_DataContext [TcType]
+ | UninfTyCtx_ProvidedContext [TcType]
+ | UninfTyCtx_TyfamRhs TcType
+ | UninfTyCtx_TysynRhs TcType
+ | UninfTyCtx_Sig TcType (LHsSigType GhcRn)
diff --git a/compiler/GHC/Tc/Gen/HsType.hs b/compiler/GHC/Tc/Gen/HsType.hs
index c002d8cc3e..0a0ec7230a 100644
--- a/compiler/GHC/Tc/Gen/HsType.hs
+++ b/compiler/GHC/Tc/Gen/HsType.hs
@@ -473,7 +473,7 @@ tc_lhs_sig_type skol_info full_hs_ty@(L loc (HsSig { sig_bndrs = hs_outer_bndrs
-- Default any unconstrained variables free in the kind
-- See Note [Escaping kind in type signatures]
; exp_kind_dvs <- candidateQTyVarsOfType exp_kind
- ; doNotQuantifyTyVars exp_kind_dvs (mk_doc exp_kind)
+ ; doNotQuantifyTyVars exp_kind_dvs (err_ctx exp_kind)
; traceTc "tc_lhs_sig_type" (ppr hs_outer_bndrs $$ ppr outer_bndrs)
; outer_bndrs <- scopedSortOuter outer_bndrs
@@ -488,10 +488,9 @@ tc_lhs_sig_type skol_info full_hs_ty@(L loc (HsSig { sig_bndrs = hs_outer_bndrs
; return (implic, mkInfForAllTys kvs ty1) }
where
- mk_doc exp_kind tidy_env
+ err_ctx exp_kind tidy_env
= do { (tidy_env2, exp_kind) <- zonkTidyTcType tidy_env exp_kind
- ; return (tidy_env2, hang (text "The kind" <+> ppr exp_kind)
- 2 (text "of type signature:" <+> ppr full_hs_ty)) }
+ ; return (tidy_env2, UninfTyCtx_Sig exp_kind full_hs_ty) }
diff --git a/compiler/GHC/Tc/TyCl.hs b/compiler/GHC/Tc/TyCl.hs
index f3e02c0fd0..afb2047d63 100644
--- a/compiler/GHC/Tc/TyCl.hs
+++ b/compiler/GHC/Tc/TyCl.hs
@@ -35,7 +35,8 @@ import GHC.Driver.Config.HsToCore
import GHC.Hs
import GHC.Tc.Errors.Types ( TcRnMessage(..), FixedRuntimeRepProvenance(..)
- , mkTcRnUnknownMessage, IllegalNewtypeReason (..) )
+ , mkTcRnUnknownMessage, IllegalNewtypeReason (..)
+ , UninferrableTyvarCtx (..) )
import GHC.Tc.TyCl.Build
import GHC.Tc.Solver( pushLevelAndSolveEqualities, pushLevelAndSolveEqualitiesX
, reportUnsolvedEqualities )
@@ -2455,11 +2456,9 @@ tcClassDecl1 roles_info class_name hs_ctxt meths fundeps sigs ats at_defs
-- class (forall a. a b ~ a c) => C b c
-- The kind of `a` is unconstrained.
; dvs <- candidateQTyVarsOfTypes ctxt
- ; let mk_doc tidy_env = do { (tidy_env2, ctxt) <- zonkTidyTcTypes tidy_env ctxt
- ; return ( tidy_env2
- , sep [ text "the class context:"
- , pprTheta ctxt ] ) }
- ; doNotQuantifyTyVars dvs mk_doc
+ ; let err_ctx tidy_env = do { (tidy_env2, ctxt) <- zonkTidyTcTypes tidy_env ctxt
+ ; return (tidy_env2, UninfTyCtx_ClassContext ctxt) }
+ ; doNotQuantifyTyVars dvs err_ctx
-- The pushLevelAndSolveEqualities will report errors for any
-- unsolved equalities, so these zonks should not encounter
@@ -2873,11 +2872,9 @@ tcTySynRhs roles_info tc_name hs_ty
-- type T = forall a. Proxy a
-- The kind of `a` is unconstrained.
; dvs <- candidateQTyVarsOfType rhs_ty
- ; let mk_doc tidy_env = do { (tidy_env2, rhs_ty) <- zonkTidyTcType tidy_env rhs_ty
- ; return ( tidy_env2
- , sep [ text "the type synonym right-hand side:"
- , ppr rhs_ty ] ) }
- ; doNotQuantifyTyVars dvs mk_doc
+ ; let err_ctx tidy_env = do { (tidy_env2, rhs_ty) <- zonkTidyTcType tidy_env rhs_ty
+ ; return (tidy_env2, UninfTyCtx_TysynRhs rhs_ty) }
+ ; doNotQuantifyTyVars dvs err_ctx
; ze <- mkEmptyZonkEnv NoFlexi
; (ze, bndrs) <- zonkTyVarBindersX ze tc_bndrs
@@ -2918,12 +2915,10 @@ tcDataDefn err_ctxt roles_info tc_name
-- data (forall a. a b ~ a c) => T b c
-- The kind of 'a' is unconstrained.
; dvs <- candidateQTyVarsOfTypes stupid_tc_theta
- ; let mk_doc tidy_env
+ ; let err_ctx tidy_env
= do { (tidy_env2, theta) <- zonkTidyTcTypes tidy_env stupid_tc_theta
- ; return ( tidy_env2
- , sep [ text "the datatype context:"
- , pprTheta theta ] ) }
- ; doNotQuantifyTyVars dvs mk_doc
+ ; return (tidy_env2, UninfTyCtx_DataContext theta) }
+ ; doNotQuantifyTyVars dvs err_ctx
-- Check that we don't use kind signatures without the extension
; kind_signatures <- xoptM LangExt.KindSignatures
@@ -3178,12 +3173,10 @@ tcTyFamInstEqnGuts fam_tc mb_clsinfo outer_hs_bndrs hs_pats hs_rhs_ty
-- See Note [Error on unconstrained meta-variables] in GHC.Tc.Utils.TcMType
-- Example: typecheck/should_fail/T17301
; dvs_rhs <- candidateQTyVarsOfType rhs_ty
- ; let mk_doc tidy_env
+ ; let err_ctx tidy_env
= do { (tidy_env2, rhs_ty) <- zonkTidyTcType tidy_env rhs_ty
- ; return ( tidy_env2
- , sep [ text "type family equation right-hand side:"
- , ppr rhs_ty ] ) }
- ; doNotQuantifyTyVars dvs_rhs mk_doc
+ ; return (tidy_env2, UninfTyCtx_TyfamRhs rhs_ty) }
+ ; doNotQuantifyTyVars dvs_rhs err_ctx
; ze <- mkEmptyZonkEnv NoFlexi
; (ze, final_tvs) <- zonkTyBndrsX ze final_tvs
diff --git a/compiler/GHC/Tc/TyCl/PatSyn.hs b/compiler/GHC/Tc/TyCl/PatSyn.hs
index 8741770977..82fa7db1f7 100644
--- a/compiler/GHC/Tc/TyCl/PatSyn.hs
+++ b/compiler/GHC/Tc/TyCl/PatSyn.hs
@@ -194,12 +194,10 @@ tcInferPatSynDecl (PSB { psb_id = lname@(L _ name), psb_args = details
-- Report un-quantifiable type variables:
-- see Note [Unquantified tyvars in a pattern synonym]
; dvs <- candidateQTyVarsOfTypes prov_theta
- ; let mk_doc tidy_env
+ ; let err_ctx tidy_env
= do { (tidy_env2, theta) <- zonkTidyTcTypes tidy_env prov_theta
- ; return ( tidy_env2
- , sep [ text "the provided context:"
- , pprTheta theta ] ) }
- ; doNotQuantifyTyVars dvs mk_doc
+ ; return ( tidy_env2, UninfTyCtx_ProvidedContext theta ) }
+ ; doNotQuantifyTyVars dvs err_ctx
; traceTc "tcInferPatSynDecl }" $ (ppr name $$ ppr ex_tvs)
; rec_fields <- lookupConstructorFields name
diff --git a/compiler/GHC/Tc/Utils/TcMType.hs b/compiler/GHC/Tc/Utils/TcMType.hs
index e3ca947cdd..e14dae75cf 100644
--- a/compiler/GHC/Tc/Utils/TcMType.hs
+++ b/compiler/GHC/Tc/Utils/TcMType.hs
@@ -131,7 +131,6 @@ import GHC.Types.Name
import GHC.Types.Var.Set
import GHC.Builtin.Types
-import GHC.Types.Error
import GHC.Types.Var.Env
import GHC.Types.Unique.Set
import GHC.Types.Basic ( TypeOrKind(..)
@@ -1853,10 +1852,7 @@ defaultTyVar def_strat tv
; writeMetaTyVar kv liftedTypeKind
; return True }
| otherwise
- = do { addErr $ mkTcRnUnknownMessage $ mkPlainError noHints $
- (vcat [ text "Cannot default kind variable" <+> quotes (ppr kv')
- , text "of kind:" <+> ppr (tyVarKind kv')
- , text "Perhaps enable PolyKinds or add a kind signature" ])
+ = do { addErr $ TcRnCannotDefaultKindVar kv' (tyVarKind kv')
-- We failed to default it, so return False to say so.
-- Hence, it'll get skolemised. That might seem odd, but we must either
-- promote, skolemise, or zap-to-Any, to satisfy GHC.Tc.Gen.HsType
@@ -2053,7 +2049,7 @@ C. Examine the class declaration at the top of this Note again.
-}
doNotQuantifyTyVars :: CandidatesQTvs
- -> (TidyEnv -> TcM (TidyEnv, SDoc))
+ -> (TidyEnv -> TcM (TidyEnv, UninferrableTyvarCtx))
-- ^ like "the class context (D a b, E foogle)"
-> TcM ()
-- See Note [Error on unconstrained meta-variables]
@@ -2072,14 +2068,7 @@ doNotQuantifyTyVars dvs where_found
; unless (null leftover_metas) $
do { let (tidy_env1, tidied_tvs) = tidyOpenTyCoVars emptyTidyEnv leftover_metas
; (tidy_env2, where_doc) <- where_found tidy_env1
- ; let msg = mkTcRnUnknownMessage $
- mkPlainError noHints $
- pprWithExplicitKindsWhen True $
- vcat [ text "Uninferrable type variable"
- <> plural tidied_tvs
- <+> pprWithCommas pprTyVar tidied_tvs
- <+> text "in"
- , where_doc ]
+ ; let msg = TcRnUninferrableTyvar tidied_tvs where_doc
; failWithTcM (tidy_env2, msg) }
; traceTc "doNotQuantifyTyVars success" empty }
@@ -2741,21 +2730,8 @@ naughtyQuantification orig_ty tv escapees
-- variables; very confusing to users!
orig_ty' = tidyType env orig_ty1
- ppr_tidied = pprTyVars . map (tidyTyCoVarOcc env)
- msg = mkTcRnUnknownMessage $ mkPlainError noHints $
- pprWithExplicitKindsWhen True $
- vcat [ sep [ text "Cannot generalise type; skolem" <> plural escapees'
- , quotes $ ppr_tidied escapees'
- , text "would escape" <+> itsOrTheir escapees' <+> text "scope"
- ]
- , sep [ text "if I tried to quantify"
- , ppr_tidied [tv]
- , text "in this type:"
- ]
- , nest 2 (pprTidiedType orig_ty')
- , text "(Indeed, I sometimes struggle even printing this correctly,"
- , text " due to its ill-scoped nature.)"
- ]
+ tidied = map (tidyTyCoVarOcc env) escapees'
+ msg = TcRnSkolemEscape tidied (tidyTyCoVarOcc env tv) orig_ty'
; failWithTcM (env, msg) }
diff --git a/compiler/GHC/Types/Error/Codes.hs b/compiler/GHC/Types/Error/Codes.hs
index 1f9fb29905..a5c751ed3d 100644
--- a/compiler/GHC/Types/Error/Codes.hs
+++ b/compiler/GHC/Types/Error/Codes.hs
@@ -539,6 +539,9 @@ type family GhcDiagnosticCode c = n | n -> c where
GhcDiagnosticCode "TcRnBadlyStaged" = 28914
GhcDiagnosticCode "TcRnStageRestriction" = 18157
GhcDiagnosticCode "TcRnTyThingUsedWrong" = 10969
+ GhcDiagnosticCode "TcRnCannotDefaultKindVar" = 79924
+ GhcDiagnosticCode "TcRnUninferrableTyvar" = 16220
+ GhcDiagnosticCode "TcRnSkolemEscape" = 71451
-- IllegalNewtypeReason
GhcDiagnosticCode "DoesNotHaveSingleField" = 23517
diff --git a/testsuite/tests/dependent/should_fail/T11334b.stderr b/testsuite/tests/dependent/should_fail/T11334b.stderr
index 57045d6df1..c9eda334bb 100644
--- a/testsuite/tests/dependent/should_fail/T11334b.stderr
+++ b/testsuite/tests/dependent/should_fail/T11334b.stderr
@@ -1,5 +1,5 @@
-T11334b.hs:8:14: error:
+T11334b.hs:8:14: error: [GHC-79924]
• Cannot default kind variable ‘a0’
of kind: k10
Perhaps enable PolyKinds or add a kind signature
@@ -7,7 +7,7 @@ T11334b.hs:8:14: error:
In the expression: Proxy :: Proxy 'Compose
In an equation for ‘p’: p = Proxy :: Proxy 'Compose
-T11334b.hs:8:14: error:
+T11334b.hs:8:14: error: [GHC-79924]
• Cannot default kind variable ‘g0’
of kind: k10 -> k0
Perhaps enable PolyKinds or add a kind signature
@@ -15,7 +15,7 @@ T11334b.hs:8:14: error:
In the expression: Proxy :: Proxy 'Compose
In an equation for ‘p’: p = Proxy :: Proxy 'Compose
-T11334b.hs:8:14: error:
+T11334b.hs:8:14: error: [GHC-79924]
• Cannot default kind variable ‘f0’
of kind: k0 -> *
Perhaps enable PolyKinds or add a kind signature
diff --git a/testsuite/tests/dependent/should_fail/T14880-2.stderr b/testsuite/tests/dependent/should_fail/T14880-2.stderr
index 56d8ff68ba..2e4df34c79 100644
--- a/testsuite/tests/dependent/should_fail/T14880-2.stderr
+++ b/testsuite/tests/dependent/should_fail/T14880-2.stderr
@@ -1,5 +1,5 @@
-T14880-2.hs:13:9: error:
+T14880-2.hs:13:9: error: [GHC-71451]
• Cannot generalise type; skolem ‘arg’ would escape its scope
if I tried to quantify (a0 :: arg) in this type:
forall arg. Proxy @{Proxy @{arg} a0 -> *} (Foo arg @a0) -> ()
diff --git a/testsuite/tests/dependent/should_fail/T14880.stderr b/testsuite/tests/dependent/should_fail/T14880.stderr
index 90e54427c0..85f8bdb80d 100644
--- a/testsuite/tests/dependent/should_fail/T14880.stderr
+++ b/testsuite/tests/dependent/should_fail/T14880.stderr
@@ -1,5 +1,5 @@
-T14880.hs:13:5: error:
+T14880.hs:13:5: error: [GHC-71451]
• Cannot generalise type; skolem ‘arg’ would escape its scope
if I tried to quantify (a0 :: arg) in this type:
forall x arg.
diff --git a/testsuite/tests/dependent/should_fail/T15076.stderr b/testsuite/tests/dependent/should_fail/T15076.stderr
index 71d3c7c156..827b2bcdcc 100644
--- a/testsuite/tests/dependent/should_fail/T15076.stderr
+++ b/testsuite/tests/dependent/should_fail/T15076.stderr
@@ -1,5 +1,5 @@
-T15076.hs:11:8: error:
+T15076.hs:11:8: error: [GHC-71451]
• Cannot generalise type; skolem ‘a’ would escape its scope
if I tried to quantify (x0 :: a) in this type:
forall a (f :: forall (x :: a). Proxy @{a} x -> *).
diff --git a/testsuite/tests/dependent/should_fail/T15076b.stderr b/testsuite/tests/dependent/should_fail/T15076b.stderr
index 8da932a044..600253fb8d 100644
--- a/testsuite/tests/dependent/should_fail/T15076b.stderr
+++ b/testsuite/tests/dependent/should_fail/T15076b.stderr
@@ -1,4 +1,4 @@
-T15076b.hs:9:8: error:
+T15076b.hs:9:8: error: [GHC-71451]
• Cannot generalise type; skolem ‘a’ would escape its scope
if I tried to quantify (x0 :: a) in this type:
forall a (f :: forall (x :: a). Proxy @{a} x -> *).
diff --git a/testsuite/tests/dependent/should_fail/T15825.stderr b/testsuite/tests/dependent/should_fail/T15825.stderr
index 5d989303a6..5a4822f1f7 100644
--- a/testsuite/tests/dependent/should_fail/T15825.stderr
+++ b/testsuite/tests/dependent/should_fail/T15825.stderr
@@ -1,5 +1,5 @@
-T15825.hs:14:10: error:
+T15825.hs:14:10: error: [GHC-71451]
• Cannot generalise type; skolem ‘k’ would escape its scope
if I tried to quantify (x0 :: k) in this type:
forall k (a :: C k). X (a @x0)
diff --git a/testsuite/tests/patsyn/should_fail/T14552.stderr b/testsuite/tests/patsyn/should_fail/T14552.stderr
index 92c1adb57b..2c1bdb8c49 100644
--- a/testsuite/tests/patsyn/should_fail/T14552.stderr
+++ b/testsuite/tests/patsyn/should_fail/T14552.stderr
@@ -1,5 +1,5 @@
-T14552.hs:22:1: error:
+T14552.hs:22:1: error: [GHC-71451]
• Cannot generalise type; skolem ‘k’ would escape its scope
if I tried to quantify (t0 :: k) in this type:
forall k (w :: k --> *). Exp a0 (F @k @(*) w t0)
diff --git a/testsuite/tests/patsyn/should_fail/T21479.stderr b/testsuite/tests/patsyn/should_fail/T21479.stderr
index 07601492a8..dc6677580d 100644
--- a/testsuite/tests/patsyn/should_fail/T21479.stderr
+++ b/testsuite/tests/patsyn/should_fail/T21479.stderr
@@ -1,5 +1,5 @@
-T21479.hs:13:1: error:
+T21479.hs:13:1: error: [GHC-16220]
• Uninferrable type variable a0 in
the provided context: (a0 :: *) ~ (Int :: *)
• In the declaration for pattern synonym ‘T1’
diff --git a/testsuite/tests/polykinds/T15795.stderr b/testsuite/tests/polykinds/T15795.stderr
index 65bfdddecc..20fb997e4c 100644
--- a/testsuite/tests/polykinds/T15795.stderr
+++ b/testsuite/tests/polykinds/T15795.stderr
@@ -1,5 +1,5 @@
-T15795.hs:12:3: error:
+T15795.hs:12:3: error: [GHC-71451]
• Cannot generalise type; skolem ‘k’ would escape its scope
if I tried to quantify (a0 :: k) in this type:
forall k (b :: k). T @k @a0 b
diff --git a/testsuite/tests/polykinds/T15795a.stderr b/testsuite/tests/polykinds/T15795a.stderr
index f4757137ce..00fa09ac82 100644
--- a/testsuite/tests/polykinds/T15795a.stderr
+++ b/testsuite/tests/polykinds/T15795a.stderr
@@ -1,5 +1,5 @@
-T15795a.hs:9:3: error:
+T15795a.hs:9:3: error: [GHC-71451]
• Cannot generalise type; skolem ‘u’ would escape its scope
if I tried to quantify (cat10 :: u) in this type:
forall u (a :: u). F @u @cat10 a
diff --git a/testsuite/tests/typecheck/no_skolem_info/T14040A.stderr b/testsuite/tests/typecheck/no_skolem_info/T14040A.stderr
index 554a4e0a32..176b198b99 100644
--- a/testsuite/tests/typecheck/no_skolem_info/T14040A.stderr
+++ b/testsuite/tests/typecheck/no_skolem_info/T14040A.stderr
@@ -1,5 +1,5 @@
-T14040A.hs:13:8: error:
+T14040A.hs:13:8: error: [GHC-71451]
• Cannot generalise type; skolem ‘a’ would escape its scope
if I tried to quantify (x0 :: a) in this type:
forall a (f :: forall (x :: a). Proxy @{a} x -> *).
diff --git a/testsuite/tests/typecheck/should_fail/T14350.stderr b/testsuite/tests/typecheck/should_fail/T14350.stderr
index 955554ab8d..4adc54c497 100644
--- a/testsuite/tests/typecheck/should_fail/T14350.stderr
+++ b/testsuite/tests/typecheck/should_fail/T14350.stderr
@@ -1,5 +1,5 @@
-T14350.hs:49:10: error:
+T14350.hs:49:10: error: [GHC-71451]
• Cannot generalise type; skolem ‘a’ would escape its scope
if I tried to quantify (x0 :: a) in this type:
forall a (b1 :: a ~> *)
diff --git a/testsuite/tests/typecheck/should_fail/T15474.stderr b/testsuite/tests/typecheck/should_fail/T15474.stderr
index 98f64213d9..23ae019c77 100644
--- a/testsuite/tests/typecheck/should_fail/T15474.stderr
+++ b/testsuite/tests/typecheck/should_fail/T15474.stderr
@@ -1,5 +1,5 @@
-T15474.hs:10:1: error:
+T15474.hs:10:1: error: [GHC-16220]
• Uninferrable type variable k0 in
the type synonym right-hand side: forall (t :: k0). Proxy @{k0} t
• In the type declaration for ‘Forall’
diff --git a/testsuite/tests/typecheck/should_fail/T15807.stderr b/testsuite/tests/typecheck/should_fail/T15807.stderr
index 8589ec1268..5ef0fe2ef8 100644
--- a/testsuite/tests/typecheck/should_fail/T15807.stderr
+++ b/testsuite/tests/typecheck/should_fail/T15807.stderr
@@ -1,5 +1,5 @@
-T15807.hs:12:3: error:
+T15807.hs:12:3: error: [GHC-71451]
• Cannot generalise type; skolem ‘f’ would escape its scope
if I tried to quantify (f0 :: f -> *) in this type:
forall f (a :: f). f a %1 -> App @f @f0 a
diff --git a/testsuite/tests/typecheck/should_fail/T16946.stderr b/testsuite/tests/typecheck/should_fail/T16946.stderr
index a923fe778e..c26e4fb339 100644
--- a/testsuite/tests/typecheck/should_fail/T16946.stderr
+++ b/testsuite/tests/typecheck/should_fail/T16946.stderr
@@ -1,5 +1,5 @@
-T16946.hs:11:9: error:
+T16946.hs:11:9: error: [GHC-71451]
• Cannot generalise type; skolem ‘k’ would escape its scope
if I tried to quantify (y0 :: k) in this type:
forall k (c :: k -> k -> *)
diff --git a/testsuite/tests/typecheck/should_fail/T17301.stderr b/testsuite/tests/typecheck/should_fail/T17301.stderr
index 4c1c693bc1..ed6cf9c59e 100644
--- a/testsuite/tests/typecheck/should_fail/T17301.stderr
+++ b/testsuite/tests/typecheck/should_fail/T17301.stderr
@@ -1,5 +1,6 @@
-T17301.hs:22:3: error:
+T17301.hs:22:3: error: [GHC-16220]
• Uninferrable type variable (a0 :: A) in
- type family equation right-hand side: MkATySing @(B a0) (SB @a0)
+ the type family equation right-hand side:
+ MkATySing @(B a0) (SB @a0)
• In the type family declaration for ‘Forget’
diff --git a/testsuite/tests/typecheck/should_fail/T17562.stderr b/testsuite/tests/typecheck/should_fail/T17562.stderr
index 22086bdd0d..24e4bc17bd 100644
--- a/testsuite/tests/typecheck/should_fail/T17562.stderr
+++ b/testsuite/tests/typecheck/should_fail/T17562.stderr
@@ -1,5 +1,5 @@
-T17562.hs:7:1: error:
+T17562.hs:7:1: error: [GHC-16220]
• Uninferrable type variable k0 in
the class context: forall (a :: k -> k0). (a b :: k0) ~ (a c :: k0)
• In the class declaration for ‘C’
diff --git a/testsuite/tests/typecheck/should_fail/T17567.stderr b/testsuite/tests/typecheck/should_fail/T17567.stderr
index 75b4de2960..841a91eac0 100644
--- a/testsuite/tests/typecheck/should_fail/T17567.stderr
+++ b/testsuite/tests/typecheck/should_fail/T17567.stderr
@@ -1,5 +1,5 @@
-T17567.hs:7:1: error:
+T17567.hs:7:1: error: [GHC-16220]
• Uninferrable type variable k0 in
the type synonym right-hand side: forall (a :: k0). Proxy @{k0} a
• In the type declaration for ‘T’
diff --git a/testsuite/tests/typecheck/should_fail/T17567StupidTheta.stderr b/testsuite/tests/typecheck/should_fail/T17567StupidTheta.stderr
index 425ac8728b..376f9733c0 100644
--- a/testsuite/tests/typecheck/should_fail/T17567StupidTheta.stderr
+++ b/testsuite/tests/typecheck/should_fail/T17567StupidTheta.stderr
@@ -2,7 +2,7 @@
T17567StupidTheta.hs:1:37: warning: [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
-T17567StupidTheta.hs:6:1: error:
+T17567StupidTheta.hs:6:1: error: [GHC-16220]
• Uninferrable type variable k0 in
the datatype context:
forall (a :: k -> k0). (a b :: k0) ~ (a c :: k0)