Commit d0ddde58 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

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.
parent f27c631a
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment