From: simonpj Date: Thu, 18 Aug 2005 10:02:54 +0000 (+0000) Subject: [project @ 2005-08-18 10:02:54 by simonpj] X-Git-Tag: Initial_conversion_from_CVS_complete~237 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=67e7de3d6b111d6f61134b591f486964411d146d;p=ghc-hetmet.git [project @ 2005-08-18 10:02:54 by simonpj] 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 --- diff --git a/ghc/compiler/iface/LoadIface.lhs b/ghc/compiler/iface/LoadIface.lhs index f24cb64..356cf22 100644 --- a/ghc/compiler/iface/LoadIface.lhs +++ b/ghc/compiler/iface/LoadIface.lhs @@ -206,7 +206,7 @@ loadInterface doc_str mod from | otherwise -> let - loc_doc = text file_path <+> colon + loc_doc = text file_path in initIfaceLcl mod loc_doc $ do diff --git a/ghc/compiler/typecheck/TcRnMonad.lhs b/ghc/compiler/typecheck/TcRnMonad.lhs index 6d2c64a..d8032b2 100644 --- a/ghc/compiler/typecheck/TcRnMonad.lhs +++ b/ghc/compiler/typecheck/TcRnMonad.lhs @@ -931,7 +931,7 @@ failIfM :: Message -> IfL a -- 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 } @@ -971,7 +971,8 @@ forkM :: SDoc -> IfL a -> IfL a 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}