[commit: ghc] master: Implememt -fdefer-type-errors (Trac #5624) (5508ada)
Simon Peyton Jones
simonpj at microsoft.com
Thu Jan 12 17:30:51 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/5508ada4b1d90ee54d92f69bbff7f66b3e8eceef
>---------------------------------------------------------------
commit 5508ada4b1d90ee54d92f69bbff7f66b3e8eceef
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Thu Jan 12 15:10:54 2012 +0000
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
compiler/coreSyn/CoreLint.lhs | 76 ++--
compiler/deSugar/DsBinds.lhs | 5 +
compiler/deSugar/DsMonad.lhs | 5 +-
compiler/ghci/Linker.lhs | 4 +-
compiler/hsSyn/Convert.lhs | 20 +-
compiler/iface/LoadIface.lhs | 10 +-
compiler/iface/MkIface.lhs | 2 +-
compiler/iface/TcIface.lhs | 2 +-
compiler/main/CmdLineParser.hs | 3 +-
compiler/main/DynFlags.hs | 16 +-
compiler/main/ErrUtils.lhs | 157 ++++----
compiler/main/ErrUtils.lhs-boot | 4 +-
compiler/main/HeaderInfo.hs | 2 +-
compiler/main/HscMain.hs | 8 +-
compiler/main/HscTypes.lhs | 4 +-
compiler/main/Packages.lhs | 8 +-
compiler/parser/Lexer.x | 6 +-
compiler/rename/RnEnv.lhs | 4 +-
compiler/rename/RnNames.lhs | 6 +-
compiler/simplCore/CoreMonad.lhs | 2 +-
compiler/stgSyn/StgLint.lhs | 40 +-
compiler/typecheck/Inst.lhs | 60 +--
compiler/typecheck/TcBinds.lhs | 4 +-
compiler/typecheck/TcCanonical.lhs | 106 +++--
compiler/typecheck/TcDeriv.lhs | 10 +-
compiler/typecheck/TcErrors.lhs | 872 +++++++++++++++++++++---------------
compiler/typecheck/TcEvidence.lhs | 19 +-
compiler/typecheck/TcExpr.lhs | 2 +-
compiler/typecheck/TcForeign.lhs | 4 +-
compiler/typecheck/TcHsSyn.lhs | 3 +
compiler/typecheck/TcInteract.lhs | 77 ++--
compiler/typecheck/TcMType.lhs | 13 +-
compiler/typecheck/TcMatches.lhs | 18 +
compiler/typecheck/TcRnDriver.lhs | 2 +-
compiler/typecheck/TcRnMonad.lhs | 149 ++++---
compiler/typecheck/TcRnTypes.lhs | 202 +++++----
compiler/typecheck/TcSMonad.lhs | 84 +----
compiler/typecheck/TcSimplify.lhs | 140 ++++--
compiler/typecheck/TcSplice.lhs | 8 +-
compiler/typecheck/TcType.lhs | 75 +++-
compiler/typecheck/TcUnify.lhs | 162 +++-----
compiler/types/InstEnv.lhs | 2 +-
compiler/types/Unify.lhs | 6 +-
docs/users_guide/flags.xml | 32 +-
docs/users_guide/using.xml | 26 ++
45 files changed, 1337 insertions(+), 1123 deletions(-)
Diff suppressed because of size. To see it, use:
git show 5508ada4b1d90ee54d92f69bbff7f66b3e8eceef
More information about the Cvs-ghc
mailing list