summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2021-05-28 18:43:59 +0530
committerZubin <zubin.duggal@gmail.com>2021-05-30 08:15:40 -0400
commit3b5465fdeefc67f10abdf3782cdda6c689553a8c (patch)
tree2cc591e747b4021704f1bd375957d94e37ca925f /compiler
parent6db8a0f76ec45d47060e28bb303e9eef60bdb16b (diff)
downloadhaskell-wip/T19244-fix.tar.gz
Fail before checking instances in checkHsigIface if exports don't match (#19244)wip/T19244-fix
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/Tc/Utils/Backpack.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/GHC/Tc/Utils/Backpack.hs b/compiler/GHC/Tc/Utils/Backpack.hs
index 837ab3d2a7..4af4aae1e1 100644
--- a/compiler/GHC/Tc/Utils/Backpack.hs
+++ b/compiler/GHC/Tc/Utils/Backpack.hs
@@ -132,6 +132,7 @@ checkHsigIface tcg_env gr sig_iface
traceTc "checkHsigIface" $ vcat
[ ppr sig_type_env, ppr sig_insts, ppr sig_exports ]
mapM_ check_export (map availName sig_exports)
+ failIfErrsM -- See Note [Fail before checking instances in checkHsigIface]
unless (null sig_fam_insts) $
panic ("GHC.Tc.Module.checkHsigIface: Cannot handle family " ++
"instances in hsig files yet...")
@@ -192,6 +193,14 @@ checkHsigIface tcg_env gr sig_iface
addErrAt (nameSrcSpan name)
(missingBootThing False name "exported by")
+-- Note [Fail before checking instances in checkHsigIface]
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- We need to be careful about failing before checking instances if there happens
+-- to be an error in the exports.
+-- Otherwise, we might proceed with typechecking (and subsequently panic-ing) on
+-- ill-kinded types that are constructed while checking instances.
+-- This lead to #19244
+
-- Note [Error reporting bad reexport]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- NB: You want to be a bit careful about what location you report on reexports.