summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-08-19 20:16:21 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-01 18:36:11 -0400
commita5aaceecaa04ce7ea5bade6eb96c0d129109c15a (patch)
tree80035738c384ef5e4bf8a4f943bbac5808c8c921 /compiler/GHC/Utils
parentdca1cb22cab4fa7f5937e9ffdc0ee32313dbd01c (diff)
downloadhaskell-a5aaceecaa04ce7ea5bade6eb96c0d129109c15a.tar.gz
Use ADTs for parser errors/warnings
Haskell and Cmm parsers/lexers now report errors and warnings using ADTs defined in GHC.Parser.Errors. They can be printed using functions in GHC.Parser.Errors.Ppr. Some of the errors provide hints with a separate ADT (e.g. to suggest to turn on some extension). For now, however, hints are not consistent across all messages. For example some errors contain the hints in the main message. I didn't want to change any message with this patch. I expect these changes to be discussed and implemented later. Surprisingly, this patch enhances performance. On CI (x86_64/deb9/hadrian, ghc/alloc): parsing001 -11.5% T13719 -2.7% MultiLayerModules -3.5% Naperian -3.1% Bump haddock submodule Metric Decrease: MultiLayerModules Naperian T13719 parsing001
Diffstat (limited to 'compiler/GHC/Utils')
-rw-r--r--compiler/GHC/Utils/Error.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/GHC/Utils/Error.hs b/compiler/GHC/Utils/Error.hs
index bad8a8b092..72b469f7d3 100644
--- a/compiler/GHC/Utils/Error.hs
+++ b/compiler/GHC/Utils/Error.hs
@@ -16,13 +16,12 @@ module GHC.Utils.Error (
Severity(..),
-- * Messages
- ErrMsg, errMsgDoc, errMsgSeverity, errMsgReason,
- ErrDoc, errDoc, errDocImportant, errDocContext, errDocSupplementary,
+ ErrMsg(..),
+ ErrDoc(..), errDoc,
mapErrDoc,
WarnMsg, MsgDoc,
Messages, ErrorMessages, WarningMessages,
unionMessages,
- errMsgSpan, errMsgContext,
errorsFound, isEmptyMessages,
isWarnMsgFatal,
warningsToMessages,
@@ -194,7 +193,6 @@ data Severity
instance ToJson Severity where
json s = JSString (show s)
-
instance Show ErrMsg where
show em = errMsgShortString em