Fix error handling
authorIan Lynagh <igloo@earth.li>
Tue, 28 Apr 2009 23:28:48 +0000 (23:28 +0000)
committerIan Lynagh <igloo@earth.li>
Tue, 28 Apr 2009 23:28:48 +0000 (23:28 +0000)
After the fix to #2500, we could get "Failing due to -Werror." but no
warnings printed. Now we don't fail in that case.

compiler/main/HeaderInfo.hs

index 8f5d020..5f4fc7c 100644 (file)
@@ -59,9 +59,10 @@ getImports dflags buf filename source_filename = do
   case unP parseHeader (mkPState buf loc dflags) of
     PFailed span err -> parseError span err
     POk pst rdr_module -> do
-      let ms@(_warns, errs) = getMessages pst
+      let _ms@(_warns, errs) = getMessages pst
       -- don't log warnings: they'll be reported when we parse the file
       -- for real.  See #2500.
+          ms = (emptyBag, errs)
       -- logWarnings warns
       if errorsFound dflags ms
         then liftIO $ throwIO $ mkSrcErr errs