Commit 84197106 authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Refactor printOrThrowWarnings

parent 455b833f
Pipeline #32338 failed with stages
in 321 minutes and 7 seconds
......@@ -55,18 +55,10 @@ shouldPrintWarning _ _
= True
-- | Given a bag of warnings, turn them into an exception if
-- -Werror is enabled, or print them out otherwise.
-- any has 'SevError', or print them out otherwise.
printOrThrowWarnings :: Logger -> DynFlags -> Bag WarnMsg -> IO ()
printOrThrowWarnings logger dflags warns = do
let (make_error, warns') =
mapAccumBagL
(\make_err warn ->
case errMsgSeverity warn of
SevWarning ->
(make_err, warn)
SevError ->
(True, warn))
False warns
if make_error
then throwIO (mkSrcErr warns')
else printBagOfErrors logger dflags warns
printOrThrowWarnings logger dflags warns
| any ((==) SevError . errMsgSeverity) warns
= throwIO (mkSrcErr warns)
| otherwise
= printBagOfErrors logger dflags warns
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment