summaryrefslogtreecommitdiff
path: root/compiler/main/ErrUtils.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-08-05 13:31:48 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2015-08-05 14:25:23 +0100
commite2b5738141d1f60858e53ed1edd7167b1a93800c (patch)
tree85ce804431207c0eef5faf3731def28d29dc35a2 /compiler/main/ErrUtils.hs
parent575abf42e218925e456bf765abb14f069ac048a0 (diff)
downloadhaskell-e2b5738141d1f60858e53ed1edd7167b1a93800c.tar.gz
Allow proper errors/warnings in core2core passes
This patch makes it possible for core-to-core passes to emit proper error messages and warnings. * New function CoreMonad.warnMsg * CoreMonad.warnMsg and errorMsg now print a proper warning/error message heading. * CoreMonad carries a SrcSpan, which is used in warning/error messages. It is initialised to be the source file name, but a core-to-core pass could set it more specifically if it had better location information. There was a bit of plumbing needed to get the filename to the right place.
Diffstat (limited to 'compiler/main/ErrUtils.hs')
-rw-r--r--compiler/main/ErrUtils.hs17
1 files changed, 15 insertions, 2 deletions
diff --git a/compiler/main/ErrUtils.hs b/compiler/main/ErrUtils.hs
index 1155b4b874..3a7d9ece23 100644
--- a/compiler/main/ErrUtils.hs
+++ b/compiler/main/ErrUtils.hs
@@ -104,12 +104,25 @@ type WarnMsg = ErrMsg
data Severity
= SevOutput
- | SevDump
+ | SevFatal
| SevInteractive
+
+ | SevDump
+ -- Log messagse intended for compiler developers
+ -- No file/line/column stuff
+
| SevInfo
+ -- Log messages intended for end users.
+ -- No file/line/column stuff.
+
| SevWarning
| SevError
- | SevFatal
+ -- SevWarning and SevError are used for warnings and errors
+ -- o The message has a file/line/column heading,
+ -- plus "warning:" or "error:",
+ -- added by mkLocMessags
+ -- o Output is intended for end users
+
instance Show ErrMsg where
show em = errMsgShortString em