| ... |
... |
@@ -424,8 +424,8 @@ defaultLogActionWithHandles out err logflags msg_class srcSpan msg |
|
424
|
424
|
MCInfo -> printErrs msg
|
|
425
|
425
|
MCFatal -> printErrs msg
|
|
426
|
426
|
MCDiagnostic SevIgnore _ _ _ -> pure () -- suppress the message
|
|
427
|
|
- MCDiagnostic _sev _rea _code relatedSpans ->
|
|
428
|
|
- decorateDiagnostic logflags msg_class srcSpan relatedSpans msg >>= printErrs
|
|
|
427
|
+ MCDiagnostic{} ->
|
|
|
428
|
+ decorateDiagnostic logflags msg_class srcSpan msg >>= printErrs
|
|
429
|
429
|
where
|
|
430
|
430
|
printOut = defaultLogActionHPrintDoc logflags False out
|
|
431
|
431
|
printErrs = defaultLogActionHPrintDoc logflags False err
|
| ... |
... |
@@ -465,13 +465,19 @@ defaultLogActionWithHandles out err logflags msg_class srcSpan msg |
|
465
|
465
|
-- `defaultLogActionWithHandles`)
|
|
466
|
466
|
--
|
|
467
|
467
|
-- This story is tracked by #24113.
|
|
468
|
|
-decorateDiagnostic :: LogFlags -> MessageClass -> SrcSpan -> [SrcSpan] -> SDoc -> IO SDoc
|
|
469
|
|
-decorateDiagnostic logflags msg_class srcSpan relatedSpans msg = addCaret
|
|
|
468
|
+decorateDiagnostic :: LogFlags -> MessageClass -> SrcSpan -> SDoc -> IO SDoc
|
|
|
469
|
+decorateDiagnostic logflags msg_class srcSpan msg = addCaret
|
|
470
|
470
|
where
|
|
471
|
471
|
-- Pretty print the warning flag, if any (#10752)
|
|
472
|
472
|
message :: SDoc
|
|
473
|
473
|
message = mkLocMessageWarningGroups (log_show_warn_groups logflags) msg_class srcSpan msg
|
|
474
|
474
|
|
|
|
475
|
+ -- The related locations are carried by the 'MCDiagnostic' message class.
|
|
|
476
|
+ relatedSpans :: [SrcSpan]
|
|
|
477
|
+ relatedSpans = case msg_class of
|
|
|
478
|
+ MCDiagnostic _ _ _ spans -> spans
|
|
|
479
|
+ _ -> []
|
|
|
480
|
+
|
|
475
|
481
|
-- The primary span is always caret'd, with the related spans drawn as
|
|
476
|
482
|
-- additional carets. Dedup so the primary isn't drawn twice when it
|
|
477
|
483
|
-- also appears among the related spans.
|