X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcErrors.lhs;h=572f82cb4422452da0b2d1f7278446f806d1e1bb;hb=a40f2735958055f7ff94e5df73e710044aa63b2c;hp=0ade93c29f0bb83e4324444e0eb62d7709cf5458;hpb=5e86045ae5f90d9138e395fde5792e50ac8f8afd;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcErrors.lhs b/compiler/typecheck/TcErrors.lhs index 0ade93c..572f82c 100644 --- a/compiler/typecheck/TcErrors.lhs +++ b/compiler/typecheck/TcErrors.lhs @@ -125,10 +125,9 @@ reportTidyWanteds ctxt unsolved ; when (null tv_eqs) $ groupErrs (reportFlat ctxt) others ; when (null tv_eqs) $ mapBagM_ (reportTidyImplic ctxt) implics - -- Only report ambiguity if no other errors happened - -- See Note [Avoiding spurious errors] - ; when (isEmptyBag implics && null non_ambigs) $ - reportAmbigErrs ctxt skols ambigs } + -- Only report ambiguity if no other errors (at all) happened + -- See Note [Avoiding spurious errors] in TcSimplify + ; ifErrsM (return ()) $ reportAmbigErrs ctxt skols ambigs } where skols = foldr (unionVarSet . ic_skols) emptyVarSet (cec_encl ctxt) @@ -645,7 +644,7 @@ warnDefaulting wanteds default_ty %************************************************************************ \begin{code} -kindErrorTcS :: CtFlavor -> TcType -> TcType -> TcS () +kindErrorTcS :: CtFlavor -> TcType -> TcType -> TcS a -- If there's a kind error, we don't want to blindly say "kind error" -- We might, say, be unifying a skolem 'a' with a type 'Int', -- in which case that's the error to report. So we set things @@ -655,7 +654,9 @@ kindErrorTcS fl ty1 ty2 do { let ctxt = CEC { cec_encl = [] , cec_extra = extra , cec_tidy = env0 } - ; reportEqErr ctxt ty1 ty2 } + ; reportEqErr ctxt ty1 ty2 + ; failM + } misMatchErrorTcS :: CtFlavor -> TcType -> TcType -> TcS a misMatchErrorTcS fl ty1 ty2 @@ -720,9 +721,9 @@ flattenForAllErrorTcS fl ty _bad_eqs \begin{code} setCtFlavorLoc :: CtFlavor -> TcM a -> TcM a -setCtFlavorLoc (Wanted loc) thing = setCtLoc loc thing -setCtFlavorLoc (Derived loc) thing = setCtLoc loc thing -setCtFlavorLoc (Given loc) thing = setCtLoc loc thing +setCtFlavorLoc (Wanted loc) thing = setCtLoc loc thing +setCtFlavorLoc (Derived loc _) thing = setCtLoc loc thing +setCtFlavorLoc (Given loc) thing = setCtLoc loc thing wrapEqErrTcS :: CtFlavor -> TcType -> TcType -> (TidyEnv -> TcType -> TcType -> SDoc -> TcM a) @@ -741,10 +742,10 @@ wrapEqErrTcS fl ty1 ty2 thing_inside (ctLocOrigin loc) ty1 ty2 ; thing_inside env3 ty1 ty2 extra } ; case fl of - Wanted loc -> do_wanted loc - Derived loc -> do_wanted loc - Given {} -> thing_inside env2 ty1 ty2 empty - -- We could print more info, but it + Wanted loc -> do_wanted loc + Derived loc _ -> do_wanted loc + Given {} -> thing_inside env2 ty1 ty2 empty + -- We could print more info, but it -- seems to be coming out already } } where