[commit: ghc] master: Fail earlier if there's an error in a type declaration (d0ddde5)
Simon Peyton Jones
simonpj at microsoft.com
Wed Aug 29 12:34:54 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/d0ddde58f928a6b156d8061c406226c4fbb7cd22
>---------------------------------------------------------------
commit d0ddde58f928a6b156d8061c406226c4fbb7cd22
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Aug 29 11:33:33 2012 +0100
Fail earlier if there's an error in a type declaration
This change means that we don't recover from erroneous type
declarations, thereby reporting fewer errors. But trying to
recover confused GHC (leading to a pattern match failure in
the compiler Trac #7175), and it turned out to be tricky
to fix that.
So this patch takes the more conservative path of failing
earlier, perhaps reporting fewer real errors.
>---------------------------------------------------------------
compiler/typecheck/TcTyClsDecls.lhs | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/compiler/typecheck/TcTyClsDecls.lhs b/compiler/typecheck/TcTyClsDecls.lhs
index 40210bc..743bd7c 100644
--- a/compiler/typecheck/TcTyClsDecls.lhs
+++ b/compiler/typecheck/TcTyClsDecls.lhs
@@ -147,11 +147,12 @@ tcTyClGroup boot_details tyclds
-- expects well-formed TyCons
; tcExtendGlobalEnv tyclss $ do
{ traceTc "Starting validity check" (ppr tyclss)
- ; mapM_ (recoverM (return ()) . addLocM checkValidTyCl)
+ ; checkNoErrs $
+ mapM_ (recoverM (return ()) . addLocM checkValidTyCl)
(flattenTyClDecls tyclds)
-- We recover, which allows us to report multiple validity errors
- -- even from successive groups. But we stop after all groups are
- -- processed if we find any errors.
+ -- but we then fail if any are wrong. Lacking the checkNoErrs
+ -- we get Trac #7175
-- Step 4: Add the implicit things;
-- we want them in the environment because
More information about the Cvs-ghc
mailing list