summaryrefslogtreecommitdiff
path: root/compiler/main/HeaderInfo.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-01-12 15:10:54 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2012-01-12 15:10:54 +0000
commit5508ada4b1d90ee54d92f69bbff7f66b3e8eceef (patch)
tree302bb0c73f96faf9249521b5baf0d879fe11fd6f /compiler/main/HeaderInfo.hs
parentb8fe21e9ba5486256c83784ca8b9a839b5c527f4 (diff)
downloadhaskell-5508ada4b1d90ee54d92f69bbff7f66b3e8eceef.tar.gz
Implememt -fdefer-type-errors (Trac #5624)
This patch implements the idea of deferring (most) type errors to runtime, instead emitting only a warning at compile time. The basic idea is very simple: * The on-the-fly unifier in TcUnify never fails; instead if it gets stuck it emits a constraint. * The constraint solver tries to solve the constraints (and is entirely unchanged, hooray). * The remaining, unsolved constraints (if any) are passed to TcErrors.reportUnsolved. With -fdefer-type-errors, instead of emitting an error message, TcErrors emits a warning, AND emits a binding for the constraint witness, binding it to (error "the error message"), via the new form of evidence TcEvidence.EvDelayedError. So, when the program is run, when (and only when) that witness is needed, the program will crash with the exact same error message that would have been given at compile time. Simple really. But, needless to say, the exercise forced me into some major refactoring. * TcErrors is almost entirely rewritten * EvVarX and WantedEvVar have gone away entirely * ErrUtils is changed a bit: * New Severity field in ErrMsg * Renamed the type Message to MsgDoc (this change touches a lot of files trivially) * One minor change is that in the constraint solver we try NOT to combine insoluble constraints, like Int~Bool, else all such type errors get combined together and result in only one error message! * I moved some definitions from TcSMonad to TcRnTypes, where they seem to belong more
Diffstat (limited to 'compiler/main/HeaderInfo.hs')
-rw-r--r--compiler/main/HeaderInfo.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/main/HeaderInfo.hs b/compiler/main/HeaderInfo.hs
index 9fad73a9f8..6322024c9e 100644
--- a/compiler/main/HeaderInfo.hs
+++ b/compiler/main/HeaderInfo.hs
@@ -123,7 +123,7 @@ mkPrelImports this_mod loc implicit_prelude import_decls
ideclAs = Nothing,
ideclHiding = Nothing }
-parseError :: SrcSpan -> Message -> IO a
+parseError :: SrcSpan -> MsgDoc -> IO a
parseError span err = throwOneError $ mkPlainErrMsg span err
--------------------------------------------------------------