Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/1c490467fce17d97c30bc518df498f9b353d10d6 >--------------------------------------------------------------- commit 1c490467fce17d97c30bc518df498f9b353d10d6 Author: Ian Lynagh <[email protected]> Date: Tue Jun 12 15:47:40 2012 +0100 Store short error message text as a string We also store the Doc still, although we don't have to; we could just convert back again, at the cost of some inefficiency. But we do need the String, so that we can print it in the Show instance. >--------------------------------------------------------------- compiler/main/ErrUtils.lhs | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/main/ErrUtils.lhs b/compiler/main/ErrUtils.lhs index dafc7e6..83f57c3 100644 --- a/compiler/main/ErrUtils.lhs +++ b/compiler/main/ErrUtils.lhs @@ -64,7 +64,8 @@ type ErrorMessages = Bag ErrMsg data ErrMsg = ErrMsg { errMsgSpans :: [SrcSpan], errMsgContext :: PrintUnqualified, - errMsgShortDoc :: MsgDoc, + errMsgShortDoc :: MsgDoc, -- errMsgShort* should always + errMsgShortString :: String, -- contain the same text errMsgExtraInfo :: MsgDoc, errMsgSeverity :: Severity } @@ -82,7 +83,7 @@ data Severity | SevFatal instance Show ErrMsg where - show em = showSDoc (errMsgShortDoc em) + show em = errMsgShortString em pprMessageBag :: Bag MsgDoc -> SDoc pprMessageBag msgs = vcat (punctuate blankLine (bagToList msgs)) @@ -110,7 +111,8 @@ makeIntoWarning err = err { errMsgSeverity = SevWarning } mk_err_msg :: DynFlags -> Severity -> SrcSpan -> PrintUnqualified -> MsgDoc -> SDoc -> ErrMsg mk_err_msg _ sev locn print_unqual msg extra = ErrMsg { errMsgSpans = [locn], errMsgContext = print_unqual - , errMsgShortDoc = msg, errMsgExtraInfo = extra + , errMsgShortDoc = msg , errMsgShortString = showSDoc msg + , errMsgExtraInfo = extra , errMsgSeverity = sev } mkLongErrMsg, mkLongWarnMsg :: DynFlags -> SrcSpan -> PrintUnqualified -> MsgDoc -> MsgDoc -> ErrMsg _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
