summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-01-09 09:47:57 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2015-01-09 10:08:46 +0000
commitdfe62eb05feab7ec4acb31bcd12fb68028eebcda (patch)
treef0d7c407db7833e95c0c87dbc83158b9ce334317 /compiler
parent327ce1d336c8fbdb068be900a187f96d1c60b851 (diff)
downloadhaskell-dfe62eb05feab7ec4acb31bcd12fb68028eebcda.tar.gz
Make TcRnMonad.reportWarning call makeIntoWarning
Previously the caller had do to that, and sometimes forgot
Diffstat (limited to 'compiler')
-rw-r--r--compiler/typecheck/TcBinds.hs2
-rw-r--r--compiler/typecheck/TcErrors.hs8
-rw-r--r--compiler/typecheck/TcRnMonad.hs15
3 files changed, 15 insertions, 10 deletions
diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs
index 7d66d16776..50bc62d087 100644
--- a/compiler/typecheck/TcBinds.hs
+++ b/compiler/typecheck/TcBinds.hs
@@ -751,7 +751,7 @@ completeTheta inferred_theta
; warn_partial_sigs <- woptM Opt_WarnPartialTypeSignatures
; msg <- mkLongErrAt loc (mk_msg inferred_diff partial_sigs) empty
; case partial_sigs of
- True | warn_partial_sigs -> reportWarning $ makeIntoWarning msg
+ True | warn_partial_sigs -> reportWarning msg
| otherwise -> return ()
False -> reportError msg
; return final_theta }
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index 21adab4f8b..31772a229c 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/typecheck/TcErrors.hs
@@ -32,7 +32,7 @@ import VarSet
import VarEnv
import NameEnv
import Bag
-import ErrUtils ( ErrMsg, makeIntoWarning, pprLocErrMsg )
+import ErrUtils ( ErrMsg, pprLocErrMsg )
import BasicTypes
import Util
import FastString
@@ -418,7 +418,7 @@ maybeReportHoleError ctxt ct err
-- only if -fwarn_partial_type_signatures is on
case cec_type_holes ctxt of
HoleError -> reportError err
- HoleWarn -> reportWarning (makeIntoWarning err)
+ HoleWarn -> reportWarning err
HoleDefer -> return ()
-- Otherwise this is a typed hole in an expression
@@ -426,7 +426,7 @@ maybeReportHoleError ctxt ct err
= -- If deferring, report a warning only if -fwarn-typed-holds is on
case cec_expr_holes ctxt of
HoleError -> reportError err
- HoleWarn -> reportWarning (makeIntoWarning err)
+ HoleWarn -> reportWarning err
HoleDefer -> return ()
maybeReportError :: ReportErrCtxt -> ErrMsg -> TcM ()
@@ -434,7 +434,7 @@ maybeReportError :: ReportErrCtxt -> ErrMsg -> TcM ()
maybeReportError ctxt err
-- See Note [Always warn with -fdefer-type-errors]
| cec_defer_type_errors ctxt
- = reportWarning (makeIntoWarning err)
+ = reportWarning err
| cec_suppress ctxt
= return ()
| otherwise
diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs
index 0f98726db8..b7038ecef1 100644
--- a/compiler/typecheck/TcRnMonad.hs
+++ b/compiler/typecheck/TcRnMonad.hs
@@ -753,11 +753,16 @@ reportError err
writeTcRef errs_var (warns, errs `snocBag` err) }
reportWarning :: ErrMsg -> TcRn ()
-reportWarning warn
- = do { traceTc "Adding warning:" (pprLocErrMsg warn) ;
- errs_var <- getErrsVar ;
- (warns, errs) <- readTcRef errs_var ;
- writeTcRef errs_var (warns `snocBag` warn, errs) }
+reportWarning err
+ = do { let warn = makeIntoWarning err
+ -- 'err' was build by mkLongErrMsg or something like that,
+ -- so it's of error severity. For a warning we downgrade
+ -- its severity to SevWarning
+
+ ; traceTc "Adding warning:" (pprLocErrMsg warn)
+ ; errs_var <- getErrsVar
+ ; (warns, errs) <- readTcRef errs_var
+ ; writeTcRef errs_var (warns `snocBag` warn, errs) }
try_m :: TcRn r -> TcRn (Either IOEnvFailure r)
-- Does try_m, with a debug-trace on failure