summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc
diff options
context:
space:
mode:
authorAlfredo Di Napoli <alfredo@well-typed.com>2020-12-08 10:28:54 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-09 21:18:34 -0500
commit9a62ecfa1653db5491f901d317d0c20454e3b426 (patch)
tree53077ab27b95b3c28eb2d3579c0abe8980ab27c0 /compiler/GHC/Tc
parentbd877edd9499a351db947cd51ed583872b2facdf (diff)
downloadhaskell-9a62ecfa1653db5491f901d317d0c20454e3b426.tar.gz
Remove errShortString, cleanup error-related functions
This commit removes the errShortString field from the ErrMsg type, allowing us to cleanup a lot of dynflag-dependent error functions, and move them in a more specialised 'GHC.Driver.Errors' closer to the driver, where they are actually used. Metric Increase: T4801 T9961
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r--compiler/GHC/Tc/Module.hs4
-rw-r--r--compiler/GHC/Tc/Utils/Monad.hs15
2 files changed, 8 insertions, 11 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index 174055bd01..819740c341 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -208,7 +208,7 @@ tcRnModule hsc_env mod_sum save_rn_syntax
hsc_src = ms_hsc_src mod_sum
dflags = hsc_dflags hsc_env
home_unit = hsc_home_unit hsc_env
- err_msg = mkPlainErrMsg dflags loc $
+ err_msg = mkPlainErrMsg loc $
text "Module does not have a RealSrcSpan:" <+> ppr this_mod
pair :: (Module, SrcSpan)
@@ -3119,5 +3119,5 @@ mark_plugin_unsafe dflags = unless (gopt Opt_PluginTrustworthy dflags) $
recordUnsafeInfer pluginUnsafe
where
unsafeText = "Use of plugins makes the module unsafe"
- pluginUnsafe = unitBag ( mkPlainWarnMsg dflags noSrcSpan
+ pluginUnsafe = unitBag ( mkPlainWarnMsg noSrcSpan
(Outputable.text unsafeText) )
diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs
index 7056ba898b..48348ce7d7 100644
--- a/compiler/GHC/Tc/Utils/Monad.hs
+++ b/compiler/GHC/Tc/Utils/Monad.hs
@@ -994,21 +994,19 @@ discardWarnings thing_inside
mkLongErrAt :: SrcSpan -> MsgDoc -> MsgDoc -> TcRn ErrMsg
mkLongErrAt loc msg extra
- = do { dflags <- getDynFlags ;
- printer <- getPrintUnqualified ;
+ = do { printer <- getPrintUnqualified ;
unit_state <- hsc_units <$> getTopEnv ;
let msg' = pprWithUnitState unit_state msg in
- return $ mkLongErrMsg dflags loc printer msg' extra }
+ return $ mkLongErrMsg loc printer msg' extra }
mkErrDocAt :: SrcSpan -> ErrDoc -> TcRn ErrMsg
mkErrDocAt loc errDoc
- = do { dflags <- getDynFlags ;
- printer <- getPrintUnqualified ;
+ = do { printer <- getPrintUnqualified ;
unit_state <- hsc_units <$> getTopEnv ;
let f = pprWithUnitState unit_state
errDoc' = mapErrDoc f errDoc
in
- return $ mkErrDoc dflags loc printer errDoc' }
+ return $ mkErrDoc loc printer errDoc' }
addLongErrAt :: SrcSpan -> MsgDoc -> MsgDoc -> TcRn ()
addLongErrAt loc msg extra = mkLongErrAt loc msg extra >>= reportError
@@ -1515,9 +1513,8 @@ add_warn reason msg extra_info
-- | Display a warning, with an optional flag, for a given location.
add_warn_at :: WarnReason -> SrcSpan -> MsgDoc -> MsgDoc -> TcRn ()
add_warn_at reason loc msg extra_info
- = do { dflags <- getDynFlags ;
- printer <- getPrintUnqualified ;
- let { warn = mkLongWarnMsg dflags loc printer
+ = do { printer <- getPrintUnqualified ;
+ let { warn = mkLongWarnMsg loc printer
msg extra_info } ;
reportWarning reason warn }