[project @ 2005-08-18 10:02:54 by simonpj]
authorsimonpj <unknown>
Thu, 18 Aug 2005 10:02:54 +0000 (10:02 +0000)
committersimonpj <unknown>
Thu, 18 Aug 2005 10:02:54 +0000 (10:02 +0000)
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

ghc/compiler/iface/LoadIface.lhs
ghc/compiler/typecheck/TcRnMonad.lhs

index f24cb64..356cf22 100644 (file)
@@ -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
 
index 6d2c64a..d8032b2 100644 (file)
@@ -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}