summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
authorSimon Peyton Jones <simon.peytonjones@gmail.com>2023-04-13 12:10:29 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-04-14 04:19:05 -0400
commitd48fbfea5f7b760ec3d13dd2947257986c095b75 (patch)
tree8898cf948e32d1a68171fd20668dfdf5a8ea0dfb /compiler/GHC
parentd7a768a415c3bd575a20b20ae9a3953aa5886ed7 (diff)
downloadhaskell-d48fbfea5f7b760ec3d13dd2947257986c095b75.tar.gz
Stop if type constructors have kind errors
Otherwise we get knock-on errors, such as #23252. This makes GHC fail a bit sooner, and I have not attempted to add recovery code, to add a fake TyCon place of the erroneous one, in an attempt to get more type errors in one pass. We could do that (perhaps) if there was a call for it.
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/Tc/TyCl.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/TyCl.hs b/compiler/GHC/Tc/TyCl.hs
index 966b612a50..de6ef49225 100644
--- a/compiler/GHC/Tc/TyCl.hs
+++ b/compiler/GHC/Tc/TyCl.hs
@@ -248,7 +248,13 @@ tcTyClDecls tyclds kisig_env role_annots
= do { -- Step 1: kind-check this group and returns the final
-- (possibly-polymorphic) kind of each TyCon and Class
-- See Note [Kind checking for type and class decls]
- (tc_tycons, kindless) <- kcTyClGroup kisig_env tyclds
+ (tc_tycons, kindless) <- checkNoErrs $
+ kcTyClGroup kisig_env tyclds
+ -- checkNoErrs: If the TyCons are ill-kinded, stop now. Else we
+ -- can get follow-on errors. Example: #23252, where the TyCon
+ -- had an ill-scoped kind forall (d::k) k (a::k). blah
+ -- and that ill-scoped kind made role inference fall over.
+
; traceTc "tcTyAndCl generalized kinds" (vcat (map ppr_tc_tycon tc_tycons))
-- Step 2: type-check all groups together, returning