Skip to content
Snippets Groups Projects
Commit 0d45533c authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by pcapriotti
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.

MERGED from commit d0ddde58
parent ce721cdc
Branches master
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment