summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Module.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-06-13 00:23:16 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2020-07-03 08:37:42 +0100
commit4bf18646acbb5a59ad8716aedc32acfe2ead0f58 (patch)
tree7704e27c8aad62e8e6aabbc70c2c9815a3aacac8 /compiler/GHC/Tc/Module.hs
parentedc8d22b2eea5d43dd6c3d0e4b2f85fc02ffa5ce (diff)
downloadhaskell-wip/T18300.tar.gz
Improve handling of data type return kindswip/T18300
Following a long conversation with Richard, this patch tidies up the handling of return kinds for data/newtype declarations (vanilla, family, and instance). I have substantially edited the Notes in TyCl, so they would bear careful reading. Fixes #18300, #18357 In GHC.Tc.Instance.Family.newFamInst we were checking some Lint-like properties with ASSSERT. Instead Richard and I have added a proper linter for axioms, and called it from lintGblEnv, which in turn is called in tcRnModuleTcRnM New tests (T18300, T18357) cause an ASSERT failure in HEAD.
Diffstat (limited to 'compiler/GHC/Tc/Module.hs')
-rw-r--r--compiler/GHC/Tc/Module.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index 5ef192befe..0145c6c776 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -268,6 +268,14 @@ tcRnModuleTcRnM hsc_env mod_sum
then tcRnHsBootDecls hsc_src local_decls
else {-# SCC "tcRnSrcDecls" #-}
tcRnSrcDecls explicit_mod_hdr local_decls export_ies
+
+ ; whenM (goptM Opt_DoCoreLinting) $
+ do { let (warns, errs) = lintGblEnv (hsc_dflags hsc_env) tcg_env
+ ; mapBagM_ (addWarn NoReason) warns
+ ; mapBagM_ addErr errs
+ ; failIfErrsM } -- if we have a lint error, we're only
+ -- going to get in deeper trouble by proceeding
+
; setGblEnv tcg_env
$ do { -- Process the export list
traceRn "rn4a: before exports" empty
@@ -2896,7 +2904,7 @@ pprTcGblEnv (TcGblEnv { tcg_type_env = type_env,
pprUFM (imp_dep_mods imports) (ppr . sort)
, text "Dependent packages:" <+>
ppr (S.toList $ imp_dep_pkgs imports)]
- where -- The use of sort is just to reduce unnecessary
+ -- The use of sort is just to reduce unnecessary
-- wobbling in testsuite output
ppr_rules :: [LRuleDecl GhcTc] -> SDoc