summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2023-05-16 21:53:43 +0200
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2023-05-16 22:05:45 +0200
commit3aee23cb2969a9626b6401664e2acc82086c960b (patch)
tree81185671028a4b39e61143ed213c538077f78a17 /compiler/GHC/Core
parent67330303714ab64751e538f318932a70c36392b6 (diff)
downloadhaskell-wip/lint-stderr.tar.gz
Output Lint errors to stderr instead of stdoutwip/lint-stderr
This is a continuation of 7b095b99, which fixed warnings but not errors. Refs #13342
Diffstat (limited to 'compiler/GHC/Core')
-rw-r--r--compiler/GHC/Core/Lint.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs
index 7bb1eb43aa..566b0985e2 100644
--- a/compiler/GHC/Core/Lint.hs
+++ b/compiler/GHC/Core/Lint.hs
@@ -302,6 +302,10 @@ path does not result in allocation in the hot path. This can be surprisingly
impactful. Changing `lint_app` reduced allocations for one test program I was
looking at by ~4%.
+Note [MCInfo for Lint]
+~~~~~~~~~~~~~~~~~~~~~~
+When printing a Lint message, use the MCInfo severity so that the
+message is printed on stderr rather than stdout (#13342).
************************************************************************
* *
@@ -425,7 +429,7 @@ displayLintResults :: Logger
-> IO ()
displayLintResults logger display_warnings pp_what pp_pgm (warns, errs)
| not (isEmptyBag errs)
- = do { logMsg logger Err.MCDump noSrcSpan
+ = do { logMsg logger Err.MCInfo noSrcSpan -- See Note [MCInfo for Lint]
$ withPprStyle defaultDumpStyle
(vcat [ lint_banner "errors" pp_what, Err.pprMessageBag errs
, text "*** Offending Program ***"
@@ -436,9 +440,7 @@ displayLintResults logger display_warnings pp_what pp_pgm (warns, errs)
| not (isEmptyBag warns)
, log_enable_debug (logFlags logger)
, display_warnings
- -- If the Core linter encounters an error, output to stderr instead of
- -- stdout (#13342)
- = logMsg logger Err.MCInfo noSrcSpan
+ = logMsg logger Err.MCInfo noSrcSpan -- See Note [MCInfo for Lint]
$ withPprStyle defaultDumpStyle
(lint_banner "warnings" pp_what $$ Err.pprMessageBag (mapBag ($$ blankLine) warns))