From b1a17507229b00820b9552a423342f8c354267d4 Mon Sep 17 00:00:00 2001 From: Alfredo Di Napoli Date: Mon, 18 Jan 2021 16:12:28 +0100 Subject: Rename ErrMsg into MsgEnvelope Updates Haddock submodule --- compiler/GHC/Utils/Error.hs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'compiler/GHC/Utils') diff --git a/compiler/GHC/Utils/Error.hs b/compiler/GHC/Utils/Error.hs index 05d98c9ed8..ed33c35551 100644 --- a/compiler/GHC/Utils/Error.hs +++ b/compiler/GHC/Utils/Error.hs @@ -14,21 +14,21 @@ module GHC.Utils.Error ( Severity(..), -- * Messages - ErrMsg(..), WarnMsg, + MsgEnvelope(..), SDoc, Messages, ErrorMessages, WarningMessages, unionMessages, errorsFound, isEmptyMessages, -- ** Formatting - pprMessageBag, pprErrMsgBagWithLoc, - pprLocErrMsg, + pprMessageBag, pprMsgEnvelopeBagWithLoc, + pprLocMsgEnvelope, formatErrDoc, -- ** Construction emptyMessages, mkLocMessage, mkLocMessageAnn, makeIntoWarning, - mkErrMsg, mkPlainErrMsg, mkErr, mkLongErrMsg, mkWarnMsg, + mkMsgEnvelope, mkPlainMsgEnvelope, mkErr, mkLongMsgEnvelope, mkWarnMsg, mkPlainWarnMsg, mkLongWarnMsg, @@ -130,18 +130,18 @@ formatErrDoc ctx docs msgs = filter (not . Outputable.isEmpty ctx) docs starred = (bullet<+>) -pprErrMsgBagWithLoc :: Bag (ErrMsg [SDoc]) -> [SDoc] -pprErrMsgBagWithLoc bag = [ pprLocErrMsg item | item <- sortMsgBag Nothing bag ] +pprMsgEnvelopeBagWithLoc :: Bag (MsgEnvelope [SDoc]) -> [SDoc] +pprMsgEnvelopeBagWithLoc bag = [ pprLocMsgEnvelope item | item <- sortMsgBag Nothing bag ] -pprLocErrMsg :: RenderableDiagnostic e => ErrMsg e -> SDoc -pprLocErrMsg (ErrMsg { errMsgSpan = s - , errMsgDiagnostic = e - , errMsgSeverity = sev - , errMsgContext = unqual }) +pprLocMsgEnvelope :: RenderableDiagnostic e => MsgEnvelope e -> SDoc +pprLocMsgEnvelope (MsgEnvelope { errMsgSpan = s + , errMsgDiagnostic = e + , errMsgSeverity = sev + , errMsgContext = unqual }) = sdocWithContext $ \ctx -> withErrStyle unqual $ mkLocMessage sev s (formatErrDoc ctx $ renderDiagnostic e) -sortMsgBag :: Maybe DynFlags -> Bag (ErrMsg e) -> [ErrMsg e] +sortMsgBag :: Maybe DynFlags -> Bag (MsgEnvelope e) -> [MsgEnvelope e] sortMsgBag dflags = maybeLimit . sortBy (cmp `on` errMsgSpan) . bagToList where cmp | fromMaybe False (fmap reverseErrors dflags) = SrcLoc.rightmost_smallest -- cgit v1.2.1