Make the forkM failure fail more tidily. Interface-file inconsistencies
give rise to failures in the IfM monad. An error message is printed, but
up to now we've also said "The impossible happened, must be a GHC bug".
That's not true, though, it could just be messed up interface files.
So this commit still makes the compiler halt, but in a tidier, less
self-accusatory way.
Still to come: when original names in interface files mention the
package Id too, the error will become clearer still.
MERGE to STABLE
| otherwise ->
let
- loc_doc = text file_path <+> colon
+ loc_doc = text file_path
in
initIfaceLcl mod loc_doc $ do
-- We use IfL here so that we can get context info out of the local env
failIfM msg
= do { env <- getLclEnv
- ; let full_msg = if_loc env $$ nest 2 msg
+ ; let full_msg = (if_loc env <> colon) $$ nest 2 msg
; ioToIOEnv (printErrs (full_msg defaultErrStyle))
; failM }
forkM doc thing_inside
= do { mb_res <- forkM_maybe doc thing_inside
; return (case mb_res of
- Nothing -> pprPanic "forkM" doc
+ Nothing -> pgmError "Cannot continue after interface file error"
+ -- pprPanic "forkM" doc
Just r -> r) }
\end{code}