summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Config
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-10-18 15:26:52 +0200
committersheaf <sam.derbyshire@gmail.com>2022-10-18 16:15:53 +0200
commit99dc3e3d76daab80a5c5209a3e0c44c9e4664e06 (patch)
tree0b35945d26b055fe4b0eb47d12099b4d1ec61279 /compiler/GHC/Driver/Config
parente1bbd36841e19812c7ed544b66256da82ce68fd5 (diff)
downloadhaskell-wip/diagnostics-config.tar.gz
Add -fsuppress-error-contexts to disable printing error contexts in errorswip/diagnostics-config
In many development environments, the source span is the primary means of seeing what an error message relates to, and the In the expression: and In an equation for: clauses are not particularly relevant. However, they can grow to be quite long, which can make the message itself both feel overwhelming and interact badly with limited-space areas. It's simple to implement this flag so we might as well do it and give the user control about how they see their messages. Fixes #21722
Diffstat (limited to 'compiler/GHC/Driver/Config')
-rw-r--r--compiler/GHC/Driver/Config/Diagnostic.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/GHC/Driver/Config/Diagnostic.hs b/compiler/GHC/Driver/Config/Diagnostic.hs
index e8bf0f5926..3a590abc9f 100644
--- a/compiler/GHC/Driver/Config/Diagnostic.hs
+++ b/compiler/GHC/Driver/Config/Diagnostic.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE TypeApplications #-}
+
-- | Functions for initialising error message printing configuration from the
-- GHC session flags.
module GHC.Driver.Config.Diagnostic
@@ -21,6 +21,7 @@ import GHC.Driver.Errors.Ppr ()
import GHC.Tc.Errors.Types
import GHC.HsToCore.Errors.Types
import GHC.Types.Error
+import GHC.Tc.Errors.Ppr
-- | Initialise the general configuration for printing diagnostic messages
-- For example, this configuration controls things like whether warnings are
@@ -47,7 +48,7 @@ initPsMessageOpts :: DynFlags -> DiagnosticOpts PsMessage
initPsMessageOpts _ = NoDiagnosticOpts
initTcMessageOpts :: DynFlags -> DiagnosticOpts TcRnMessage
-initTcMessageOpts _ = NoDiagnosticOpts
+initTcMessageOpts dflags = TcRnMessageOpts { tcOptsShowContext = gopt Opt_ShowErrorContext dflags }
initDsMessageOpts :: DynFlags -> DiagnosticOpts DsMessage
initDsMessageOpts _ = NoDiagnosticOpts