Skip to content
Browse files

when -WError, all warnings are errors

  • Loading branch information...
1 parent b541c7a commit 196a5e6a52e329e4fb9b7ec89de5b7edb1153033 @JPMoresmau committed Jun 10, 2014
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/Language/Haskell/BuildWrapper/GHC.hs
View
14 src/Language/Haskell/BuildWrapper/GHC.hs
@@ -298,19 +298,19 @@ ghcWithASTNotes f ff base_dir contents shouldAddTargets= do
logAction :: IORef [BWNote] -> DynFlags -> Severity -> SrcSpan -> PprStyle -> Message -> IO ()
#endif
logAction ref df s loc style msg
- | (Just status)<-bwSeverity s=do
+ | (Just status)<-bwSeverity df s=do
let n=BWNote { bwnLocation = ghcSpanToBWLocation base_dir loc
, bwnStatus = status
, bwnTitle = removeBaseDir base_dir $ removeStatus status $ showSDUser (qualName style,qualModule style) df msg
}
modifyIORef ref $ \ ns -> ns ++ [n]
| otherwise=return ()
- bwSeverity :: Severity -> Maybe BWNoteStatus
- bwSeverity SevWarning = Just BWWarning
- bwSeverity SevError = Just BWError
- bwSeverity SevFatal = Just BWError
- bwSeverity _ = Nothing
+ bwSeverity :: DynFlags -> Severity -> Maybe BWNoteStatus
+ bwSeverity df SevWarning = Just (if dopt Opt_WarnIsError df then BWError else BWWarning)
+ bwSeverity _ SevError = Just BWError
+ bwSeverity _ SevFatal = Just BWError
+ bwSeverity _ _ = Nothing
-- | Convert 'GHC.Messages' to '[BWNote]'.
@@ -1004,7 +1004,7 @@ ghcErrMsgToNote df= ghcMsgToNote df BWError
-- | convert a GHC warning message to our note type
ghcWarnMsgToNote :: DynFlags -> FilePath -> WarnMsg -> BWNote
-ghcWarnMsgToNote df= ghcMsgToNote df BWWarning
+ghcWarnMsgToNote df= ghcMsgToNote df (if dopt Opt_WarnIsError df then BWError else BWWarning)
-- | convert a GHC message to our note type
-- Note that we do *not* include the extra info, since that information is

0 comments on commit 196a5e6

Please sign in to comment.
Something went wrong with that request. Please try again.