summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-06-18 14:12:54 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2015-06-18 14:15:59 +0100
commit02bac0254182def11029e2f7373ba8d2ba9ebe44 (patch)
tree9b254a1af59a751f28af395b98b52b51b0d61a39
parent4a7a6c3ac869f74dfe1c9af09c48faadc0ecba16 (diff)
downloadhaskell-02bac0254182def11029e2f7373ba8d2ba9ebe44.tar.gz
Remove some horrible munging of origins for Coercible
I just didn't think it was buying enough for all the cruft it caused. We can put some back if people start complaining about poor error messages. I forget quite how I tripped over this but I got sucked in. * Lots of tidying up in TcErrors * Rename pprArisingAt to pprCtLoc, by analogy with pprCtOrigin * Remove CoercibleOrigin data constructor from CtOrigin * Make relevantBindings return a Ct with a zonked and tidied CtOrigin * Add to TcRnTypes ctOrigin :: Ct -> CtOrigin ctEvOrigin :: CtEvidence -> CtOrigin setCtLoc :: Ct -> CtLoc -> Ct
-rw-r--r--compiler/typecheck/Inst.hs17
-rw-r--r--compiler/typecheck/TcErrors.hs228
-rw-r--r--compiler/typecheck/TcMType.hs4
-rw-r--r--compiler/typecheck/TcRnTypes.hs51
-rw-r--r--testsuite/tests/deriving/should_fail/T4846.stderr7
-rw-r--r--testsuite/tests/deriving/should_fail/T5498.stderr9
-rw-r--r--testsuite/tests/deriving/should_fail/T6147.stderr7
-rw-r--r--testsuite/tests/deriving/should_fail/T7148.stderr22
-rw-r--r--testsuite/tests/deriving/should_fail/T7148a.stderr18
-rw-r--r--testsuite/tests/deriving/should_fail/T8851.stderr21
-rw-r--r--testsuite/tests/deriving/should_fail/T8984.stderr8
-rw-r--r--testsuite/tests/gadt/CasePrune.stderr7
-rw-r--r--testsuite/tests/ghci/scripts/Defer02.stderr64
-rw-r--r--testsuite/tests/ghci/scripts/T8649.stderr6
-rw-r--r--testsuite/tests/ghci/scripts/ghci050.stderr6
-rw-r--r--testsuite/tests/ghci/scripts/ghci051.stderr6
-rw-r--r--testsuite/tests/ghci/scripts/ghci052.stderr24
-rw-r--r--testsuite/tests/ghci/scripts/ghci053.stderr12
-rw-r--r--testsuite/tests/indexed-types/should_fail/T6088.stderr3
-rw-r--r--testsuite/tests/indexed-types/should_fail/T9580.stderr22
-rw-r--r--testsuite/tests/module/mod180.stderr6
-rw-r--r--testsuite/tests/polykinds/T7438.stderr10
-rw-r--r--testsuite/tests/roles/should_fail/Roles10.stderr7
-rw-r--r--testsuite/tests/roles/should_fail/RolesIArray.stderr114
-rw-r--r--testsuite/tests/typecheck/bug1465/bug1465.stderr6
-rw-r--r--testsuite/tests/typecheck/should_compile/FD3.stderr11
-rw-r--r--testsuite/tests/typecheck/should_fail/T10285.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/T10495.stderr1
-rw-r--r--testsuite/tests/typecheck/should_fail/T10534.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/T5853.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr20
-rw-r--r--testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr10
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail182.stderr7
33 files changed, 342 insertions, 404 deletions
diff --git a/compiler/typecheck/Inst.hs b/compiler/typecheck/Inst.hs
index fecb11ac72..16e2710785 100644
--- a/compiler/typecheck/Inst.hs
+++ b/compiler/typecheck/Inst.hs
@@ -232,21 +232,8 @@ instCallConstraints orig preds
= do { co <- unifyType ty1 ty2
; return (EvCoercion co) }
| otherwise
- = do { ev_var <- emitWanted modified_orig pred
+ = do { ev_var <- emitWanted orig pred
; return (EvId ev_var) }
- where
- -- Coercible constraints appear as normal class constraints, but
- -- are aggressively canonicalized and manipulated during solving.
- -- The final equality to solve may barely resemble the initial
- -- constraint. Here, we remember the initial constraint in a
- -- CtOrigin for better error messages. It's perhaps worthwhile
- -- considering making this approach general, for other class
- -- constraints, too.
- modified_orig
- | Just (Representational, ty1, ty2) <- getEqPredTys_maybe pred
- = CoercibleOrigin ty1 ty2
- | otherwise
- = orig
instDFunType :: DFunId -> [DFunInstType] -> TcM ([TcType], TcThetaType)
-- See Note [DFunInstType: instantiating types] in InstEnv
@@ -408,7 +395,7 @@ syntaxNameCtxt name orig ty tidy_env
<+> ptext (sLit "(needed by a syntactic construct)")
, nest 2 (ptext (sLit "has the required type:")
<+> ppr (tidyType tidy_env ty))
- , nest 2 (pprArisingAt inst_loc) ]
+ , nest 2 (pprCtLoc inst_loc) ]
; return (tidy_env, msg) }
{-
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index 946ecdeeb6..20103dd760 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/typecheck/TcErrors.hs
@@ -30,7 +30,6 @@ import Id
import Var
import VarSet
import VarEnv
-import NameEnv
import Bag
import ErrUtils ( ErrMsg, pprLocErrMsg )
import BasicTypes
@@ -362,11 +361,13 @@ reportWanteds ctxt (WC { wc_simple = simples, wc_insol = insols, wc_impl = impli
is_hole ct _ = isHoleCt ct
is_given ct _ = not (isWantedCt ct) -- The Derived ones are actually all from Givens
- is_equality ct pred = not (isDerivedCt ct) && (case pred of
- EqPred {} -> True
- _ -> False)
- is_skol_eq ct (EqPred NomEq ty1 ty2)
- = not (isDerivedCt ct) && isRigidOrSkol ty1 && isRigidOrSkol ty2
+
+ is_equality _ (EqPred {}) = True
+ is_equality _ _ = False
+
+ is_skol_eq ct (EqPred NomEq ty1 ty2) = not (isDerivedCt ct)
+ && isRigidOrSkol ty1
+ && isRigidOrSkol ty2
is_skol_eq _ _ = False
is_dict _ (ClassPred {}) = True
@@ -547,6 +548,15 @@ tryReporter ctxt (str, keep_me, suppress_after, reporter) cts
where
(yeses, nos) = partition (\ct -> keep_me ct (classifyPredType (ctPred ct))) cts
+
+pprArising :: CtOrigin -> SDoc
+-- Used for the main, top-level error message
+-- We've done special processing for TypeEq, KindEq, Given
+pprArising (TypeEqOrigin {}) = empty
+pprArising (KindEqOrigin {}) = empty
+pprArising (GivenOrigin {}) = empty
+pprArising orig = pprCtOrigin orig
+
-- Add the "arising from..." part to a message about bunch of dicts
addArising :: CtOrigin -> SDoc -> SDoc
addArising orig msg = hang msg 2 (pprArising orig)
@@ -568,7 +578,7 @@ pprWithArising (ct:cts)
where
loc = ctLoc ct
ppr_one ct' = hang (parens (pprType (ctPred ct')))
- 2 (pprArisingAt (ctLoc ct'))
+ 2 (pprCtLoc (ctLoc ct'))
mkErrorMsgFromCt :: ReportErrCtxt -> Ct -> SDoc -> TcM ErrMsg
mkErrorMsgFromCt ctxt ct msg
@@ -666,13 +676,12 @@ solve it.
mkIrredErr :: ReportErrCtxt -> [Ct] -> TcM ErrMsg
mkIrredErr ctxt cts
- = do { (ctxt, binds_msg, _) <- relevantBindings True ctxt ct1
+ = do { (ctxt, binds_msg, ct1) <- relevantBindings True ctxt ct1
+ ; let orig = ctOrigin ct1
+ msg = couldNotDeduce (getUserGivens ctxt) (map ctPred cts, orig)
; mkErrorMsgFromCt ctxt ct1 (msg $$ binds_msg) }
where
(ct1:_) = cts
- orig = ctLocOrigin (ctLoc ct1)
- givens = getUserGivens ctxt
- msg = couldNotDeduce givens (map ctPred cts, orig)
----------------
mkHoleError :: ReportErrCtxt -> Ct -> TcM ErrMsg
@@ -683,7 +692,7 @@ mkHoleError ctxt ct@(CHoleCan { cc_occ = occ, cc_hole = hole_sort })
2 (ptext (sLit "with type:") <+> pprType (ctEvPred (ctEvidence ct)))
, ppUnless (null tyvars) (ptext (sLit "Where:") <+> vcat tyvars_msg)
, hint ]
- ; (ctxt, binds_doc, _) <- relevantBindings False ctxt ct
+ ; (ctxt, binds_doc, ct) <- relevantBindings False ctxt ct
-- The 'False' means "don't filter the bindings"; see Trac #8191
; mkErrorMsgFromCt ctxt ct (msg $$ binds_doc) }
where
@@ -713,19 +722,20 @@ mkHoleError _ ct = pprPanic "mkHoleError" (ppr ct)
----------------
mkIPErr :: ReportErrCtxt -> [Ct] -> TcM ErrMsg
mkIPErr ctxt cts
- = do { (ctxt, bind_msg, _) <- relevantBindings True ctxt ct1
+ = do { (ctxt, bind_msg, ct1) <- relevantBindings True ctxt ct1
+ ; let orig = ctOrigin ct1
+ preds = map ctPred cts
+ givens = getUserGivens ctxt
+ msg | null givens
+ = addArising orig $
+ sep [ ptext (sLit "Unbound implicit parameter") <> plural cts
+ , nest 2 (pprTheta preds) ]
+ | otherwise
+ = couldNotDeduce givens (preds, orig)
+
; mkErrorMsgFromCt ctxt ct1 (msg $$ bind_msg) }
where
(ct1:_) = cts
- orig = ctLocOrigin (ctLoc ct1)
- preds = map ctPred cts
- givens = getUserGivens ctxt
- msg | null givens
- = addArising orig $
- sep [ ptext (sLit "Unbound implicit parameter") <> plural cts
- , nest 2 (pprTheta preds) ]
- | otherwise
- = couldNotDeduce givens (preds, orig)
{-
************************************************************************
@@ -762,38 +772,36 @@ mkEqErr _ [] = panic "mkEqErr"
mkEqErr1 :: ReportErrCtxt -> Ct -> TcM ErrMsg
-- Wanted constraints only!
mkEqErr1 ctxt ct
- | isGiven ev
- = do { (ctxt, binds_msg, _) <- relevantBindings True ctxt ct
- ; let (given_loc, given_msg) = mk_given (cec_encl ctxt)
+ | isGivenCt ct
+ = do { (ctxt, binds_msg, ct) <- relevantBindings True ctxt ct
+ ; let (given_loc, given_msg) = mk_given (ctLoc ct) (cec_encl ctxt)
; dflags <- getDynFlags
; mkEqErr_help dflags ctxt (given_msg $$ binds_msg)
- (ct { cc_ev = ev {ctev_loc = given_loc}}) -- Note [Inaccessible code]
+ (setCtLoc ct given_loc) -- Note [Inaccessible code]
Nothing ty1 ty2 }
| otherwise -- Wanted or derived
- = do { (ctxt, binds_msg, tidy_orig) <- relevantBindings True ctxt ct
+ = do { (ctxt, binds_msg, ct) <- relevantBindings True ctxt ct
; rdr_env <- getGlobalRdrEnv
; fam_envs <- tcGetFamInstEnvs
- ; let (is_oriented, wanted_msg) = mk_wanted_extra tidy_orig
- coercible_msg = case ctEvEqRel ev of
+ ; let (is_oriented, wanted_msg) = mk_wanted_extra (ctOrigin ct)
+ coercible_msg = case ctEqRel ct of
NomEq -> empty
ReprEq -> mkCoercibleExplanation rdr_env fam_envs ty1 ty2
; dflags <- getDynFlags
- ; traceTc "mkEqErr1" (ppr ct $$ pprCtOrigin (ctLocOrigin loc) $$ pprCtOrigin tidy_orig)
+ ; traceTc "mkEqErr1" (ppr ct $$ pprCtOrigin (ctOrigin ct))
; mkEqErr_help dflags ctxt (wanted_msg $$ coercible_msg $$ binds_msg)
ct is_oriented ty1 ty2 }
where
- ev = ctEvidence ct
- loc = ctEvLoc ev
- (ty1, ty2) = getEqPredTys (ctEvPred ev)
+ (ty1, ty2) = getEqPredTys (ctPred ct)
- mk_given :: [Implication] -> (CtLoc, SDoc)
+ mk_given :: CtLoc -> [Implication] -> (CtLoc, SDoc)
-- For given constraints we overwrite the env (and hence src-loc)
-- with one from the implication. See Note [Inaccessible code]
- mk_given [] = (loc, empty)
- mk_given (implic : _) = (setCtLocEnv loc (ic_env implic)
- , hang (ptext (sLit "Inaccessible code in"))
- 2 (ppr (ic_info implic)))
+ mk_given loc [] = (loc, empty)
+ mk_given loc (implic : _) = (setCtLocEnv loc (ic_env implic)
+ , hang (ptext (sLit "Inaccessible code in"))
+ 2 (ppr (ic_info implic)))
-- If the types in the error message are the same as the types
-- we are unifying, don't add the extra expected/actual message
@@ -810,20 +818,7 @@ mkEqErr1 ctxt ct
TypeEqOrigin {} -> snd (mkExpectedActualMsg cty1 cty2 sub_o)
_ -> empty
- mk_wanted_extra orig@(FunDepOrigin1 {}) = (Nothing, pprArising orig)
- mk_wanted_extra orig@(FunDepOrigin2 {}) = (Nothing, pprArising orig)
- mk_wanted_extra orig@(DerivOriginCoerce _ oty1 oty2)
- = (Nothing, pprArising orig $+$ mkRoleSigs oty1 oty2)
- mk_wanted_extra orig@(CoercibleOrigin oty1 oty2)
- -- if the origin types are the same as the final types, don't
- -- clutter output with repetitive information
- | not (oty1 `eqType` ty1 && oty2 `eqType` ty2) &&
- not (oty1 `eqType` ty2 && oty2 `eqType` ty1)
- = (Nothing, pprArising orig $+$ mkRoleSigs oty1 oty2)
- | otherwise
- -- still print role sigs even if types line up
- = (Nothing, mkRoleSigs oty1 oty2)
- mk_wanted_extra _ = (Nothing, empty)
+ mk_wanted_extra _ = (Nothing, empty)
-- | This function tries to reconstruct why a "Coercible ty1 ty2" constraint
-- is left over.
@@ -872,8 +867,14 @@ mkCoercibleExplanation rdr_env fam_envs ty1 ty2
| otherwise
= False
+{-
-- | Make a listing of role signatures for all the parameterised tycons
-- used in the provided types
+
+
+-- SLPJ Jun 15: I could not convince myself that these hints were really
+-- useful. Maybe they are, but I think we need more work to make them
+-- actually helpful.
mkRoleSigs :: Type -> Type -> SDoc
mkRoleSigs ty1 ty2
= ppUnless (null role_sigs) $
@@ -890,6 +891,7 @@ mkRoleSigs ty1 ty2
= Just $ hsep $ [text "type role", ppr tc] ++ map ppr roles
where
roles = tyConRoles tc
+-}
mkEqErr_help :: DynFlags -> ReportErrCtxt -> SDoc
-> Ct
@@ -932,7 +934,8 @@ mkTyVarEqErr dflags ctxt extra ct oriented tv1 ty2
| OC_Occurs <- occ_check_expand
, NomEq <- ctEqRel ct -- reporting occurs check for Coercible is strange
- = do { let occCheckMsg = hang (text "Occurs check: cannot construct the infinite type:")
+ = do { let occCheckMsg = addArising (ctOrigin ct) $
+ hang (text "Occurs check: cannot construct the infinite type:")
2 (sep [ppr ty1, char '~', ppr ty2])
extra2 = mkEqInfoMsg ct ty1 ty2
; mkErrorMsgFromCt ctxt ct (occCheckMsg $$ extra2 $$ extra) }
@@ -951,7 +954,7 @@ mkTyVarEqErr dflags ctxt extra ct oriented tv1 ty2
| (implic:_) <- cec_encl ctxt
, Implic { ic_skols = skols } <- implic
, tv1 `elem` skols
- = mkErrorMsgFromCt ctxt ct (vcat [ misMatchMsg oriented eq_rel ty1 ty2
+ = mkErrorMsgFromCt ctxt ct (vcat [ misMatchMsg ct oriented ty1 ty2
, extraTyVarInfo ctxt tv1 ty2
, extra ])
@@ -960,7 +963,7 @@ mkTyVarEqErr dflags ctxt extra ct oriented tv1 ty2
, Implic { ic_env = env, ic_skols = skols, ic_info = skol_info } <- implic
, let esc_skols = filter (`elemVarSet` (tyVarsOfType ty2)) skols
, not (null esc_skols)
- = do { let msg = misMatchMsg oriented eq_rel ty1 ty2
+ = do { let msg = misMatchMsg ct oriented ty1 ty2
esc_doc = sep [ ptext (sLit "because type variable") <> plural esc_skols
<+> pprQuotedList esc_skols
, ptext (sLit "would escape") <+>
@@ -978,7 +981,7 @@ mkTyVarEqErr dflags ctxt extra ct oriented tv1 ty2
-- Nastiest case: attempt to unify an untouchable variable
| (implic:_) <- cec_encl ctxt -- Get the innermost context
, Implic { ic_env = env, ic_given = given, ic_info = skol_info } <- implic
- = do { let msg = misMatchMsg oriented eq_rel ty1 ty2
+ = do { let msg = misMatchMsg ct oriented ty1 ty2
tclvl_extra
= nest 2 $
sep [ quotes (ppr tv1) <+> ptext (sLit "is untouchable")
@@ -999,7 +1002,6 @@ mkTyVarEqErr dflags ctxt extra ct oriented tv1 ty2
k1 = tyVarKind tv1
k2 = typeKind ty2
ty1 = mkTyVarTy tv1
- eq_rel = ctEqRel ct
mkEqInfoMsg :: Ct -> TcType -> TcType -> SDoc
-- Report (a) ambiguity if either side is a type function application
@@ -1043,19 +1045,15 @@ misMatchOrCND ctxt ct oriented ty1 ty2
isGivenCt ct
-- If the equality is unconditionally insoluble
-- or there is no context, don't report the context
- = misMatchMsg oriented eq_rel ty1 ty2
+ = misMatchMsg ct oriented ty1 ty2
| otherwise
= couldNotDeduce givens ([eq_pred], orig)
where
- eq_rel = ctEqRel ct
- givens = [ given | given@(_, _, no_eqs, _) <- getUserGivens ctxt, not no_eqs]
- -- Keep only UserGivens that have some equalities
-
- (eq_pred, orig) = case eq_rel of
- NomEq -> ( mkTcEqPred ty1 ty2
- , TypeEqOrigin { uo_actual = ty1, uo_expected = ty2 })
- ReprEq -> ( mkCoerciblePred ty1 ty2
- , CoercibleOrigin ty1 ty2 )
+ ev = ctEvidence ct
+ eq_pred = ctEvPred ev
+ orig = ctEvOrigin ev
+ givens = [ given | given@(_, _, no_eqs, _) <- getUserGivens ctxt, not no_eqs]
+ -- Keep only UserGivens that have some equalities
couldNotDeduce :: [UserGiven] -> (ThetaType, CtOrigin) -> SDoc
couldNotDeduce givens (wanteds, orig)
@@ -1078,7 +1076,7 @@ extraTyVarInfo :: ReportErrCtxt -> TcTyVar -> TcType -> SDoc
-- Add on extra info about skolem constants
-- NB: The types themselves are already tidied
extraTyVarInfo ctxt tv1 ty2
- = nest 2 (tv_extra tv1 $$ ty_extra ty2)
+ = tv_extra tv1 $$ ty_extra ty2
where
implics = cec_encl ctxt
ty_extra ty = case tcGetTyVar_maybe ty of
@@ -1124,30 +1122,44 @@ kindErrorMsg ty1 ty2
k2 = typeKind ty2
--------------------
-misMatchMsg :: Maybe SwapFlag -> EqRel -> TcType -> TcType -> SDoc
+misMatchMsg :: Ct -> Maybe SwapFlag -> TcType -> TcType -> SDoc
-- Types are already tidy
-- If oriented then ty1 is actual, ty2 is expected
-misMatchMsg oriented eq_rel ty1 ty2
- | Just IsSwapped <- oriented
- = misMatchMsg (Just NotSwapped) eq_rel ty2 ty1
+misMatchMsg ct oriented ty1 ty2
| Just NotSwapped <- oriented
- = sep [ text "Couldn't match" <+> repr1 <+> text "expected" <+>
- what <+> quotes (ppr ty2)
- , nest (12 + extra_space) $
- text "with" <+> repr2 <+> text "actual" <+> what <+> quotes (ppr ty1)
+ = misMatchMsg ct (Just IsSwapped) ty2 ty1
+
+ | otherwise -- So now we have Nothing or (Just IsSwapped)
+ -- For some reason we treat Nothign like IsSwapped
+ = addArising orig $
+ sep [ text herald1 <+> quotes (ppr ty1)
+ , nest padding $
+ text herald2 <+> quotes (ppr ty2)
, sameOccExtra ty2 ty1 ]
- | otherwise
- = sep [ text "Couldn't match" <+> repr1 <+> what <+> quotes (ppr ty1)
- , nest (15 + extra_space) $
- text "with" <+> repr2 <+> quotes (ppr ty2)
- , sameOccExtra ty1 ty2 ]
where
- what | isKind ty1 = ptext (sLit "kind")
- | otherwise = ptext (sLit "type")
-
- (repr1, repr2, extra_space) = case eq_rel of
- NomEq -> (empty, empty, 0)
- ReprEq -> (text "representation of", text "that of", 10)
+ herald1 = conc [ "Couldn't match"
+ , if is_repr then "representation of" else ""
+ , if is_oriented then "expected" else ""
+ , what ]
+ herald2 = conc [ "with"
+ , if is_repr then "that of" else ""
+ , if is_oriented then ("actual " ++ what) else "" ]
+ padding = length herald1 - length herald2
+
+ is_repr = case ctEqRel ct of { ReprEq -> True; NomEq -> False }
+ is_oriented = isJust oriented
+
+ orig = ctOrigin ct
+ what | isKind ty1 = "kind"
+ | otherwise = "type"
+
+ conc :: [String] -> String
+ conc = foldr1 add_space
+
+ add_space :: String -> String -> String
+ add_space s1 s2 | null s1 = s2
+ | null s2 = s1
+ | otherwise = s1 ++ (' ' : s2)
mkExpectedActualMsg :: Type -> Type -> CtOrigin -> (Maybe SwapFlag, SDoc)
-- NotSwapped means (actual, expected), IsSwapped is the reverse
@@ -1294,10 +1306,8 @@ mk_dict_err :: ReportErrCtxt -> (Ct, ClsInstLookupResult)
-- from an overlap (returning Left clas), otherwise return (Right pred)
mk_dict_err ctxt (ct, (matches, unifiers, unsafe_overlapped))
| null matches -- No matches but perhaps several unifiers
- = do { let (is_ambig, ambig_msg) = mkAmbigMsg ct
- ; (ctxt, binds_msg, _) <- relevantBindings True ctxt ct
- ; traceTc "mk_dict_err" (ppr ct $$ ppr is_ambig $$ ambig_msg)
- ; return (ctxt, cannot_resolve_msg is_ambig binds_msg ambig_msg) }
+ = do { (ctxt, binds_msg, ct) <- relevantBindings True ctxt ct
+ ; return (ctxt, cannot_resolve_msg ct binds_msg) }
| null unsafe_overlapped -- Some matches => overlap errors
= return (ctxt, overlap_msg)
@@ -1305,7 +1315,7 @@ mk_dict_err ctxt (ct, (matches, unifiers, unsafe_overlapped))
| otherwise
= return (ctxt, safe_haskell_msg)
where
- orig = ctLocOrigin (ctLoc ct)
+ orig = ctOrigin ct
pred = ctPred ct
(clas, tys) = getClassPredTys pred
ispecs = [ispec | (ispec, _) <- matches]
@@ -1313,12 +1323,15 @@ mk_dict_err ctxt (ct, (matches, unifiers, unsafe_overlapped))
givens = getUserGivens ctxt
all_tyvars = all isTyVarTy tys
- cannot_resolve_msg has_ambig_tvs binds_msg ambig_msg
+ cannot_resolve_msg ct binds_msg
= vcat [ addArising orig no_inst_msg
, vcat (pp_givens givens)
, ppWhen (has_ambig_tvs && not (null unifiers && null givens))
(vcat [ ambig_msg, binds_msg, potential_msg ])
, show_fixes (add_to_ctxt_fixes has_ambig_tvs ++ drv_fixes) ]
+ where
+ (has_ambig_tvs, ambig_msg) = mkAmbigMsg ct
+ orig = ctOrigin ct
potential_msg
= ppWhen (not (null unifiers) && want_potential orig) $
@@ -1596,12 +1609,12 @@ getSkolemInfo (implic:implics) tv
relevantBindings :: Bool -- True <=> filter by tyvar; False <=> no filtering
-- See Trac #8191
-> ReportErrCtxt -> Ct
- -> TcM (ReportErrCtxt, SDoc, CtOrigin)
+ -> TcM (ReportErrCtxt, SDoc, Ct)
-- Also returns the zonked and tidied CtOrigin of the constraint
relevantBindings want_filtering ctxt ct
= do { dflags <- getDynFlags
; (env1, tidy_orig) <- zonkTidyOrigin (cec_tidy ctxt) (ctLocOrigin loc)
- ; let ct_tvs = tyVarsOfCt ct `unionVarSet` extra_tvs
+ ; let ct_tvs = tyVarsOfCt ct `unionVarSet` extra_tvs
-- For *kind* errors, report the relevant bindings of the
-- enclosing *type* equality, because that's more useful for the programmer
@@ -1621,18 +1634,20 @@ relevantBindings want_filtering ctxt ct
-- tcl_bndrs has the innermost bindings first,
-- which are probably the most relevant ones
- ; let doc = hang (ptext (sLit "Relevant bindings include"))
- 2 (vcat docs $$ max_msg)
- max_msg | discards
- = ptext (sLit "(Some bindings suppressed; use -fmax-relevant-binds=N or -fno-max-relevant-binds)")
- | otherwise = empty
+ ; let doc = ppUnless (null docs) $
+ hang (ptext (sLit "Relevant bindings include"))
+ 2 (vcat docs $$ ppWhen discards discardMsg)
- ; if null docs
- then return (ctxt, empty, tidy_orig)
- else return (ctxt { cec_tidy = tidy_env' }, doc, tidy_orig) }
+ -- Put a zonked, tidied CtOrigin into the Ct
+ loc' = setCtLocOrigin loc tidy_orig
+ ct' = setCtLoc ct loc'
+ ctxt' = ctxt { cec_tidy = tidy_env' }
+
+ ; return (ctxt', doc, ct') }
where
- loc = ctLoc ct
- lcl_env = ctLocEnv loc
+ ev = ctEvidence ct
+ loc = ctEvLoc ev
+ lcl_env = ctLocEnv loc
run_out :: Maybe Int -> Bool
run_out Nothing = False
@@ -1676,6 +1691,9 @@ relevantBindings want_filtering ctxt ct
-- Keep this binding, decrement fuel
else go tidy_env' ct_tvs (dec_max n_left) new_seen (doc:docs) discards tc_bndrs }
+discardMsg :: SDoc
+discardMsg = ptext (sLit "(Some bindings suppressed; use -fmax-relevant-binds=N or -fno-max-relevant-binds)")
+
-----------------------
warnDefaulting :: [Ct] -> Type -> TcM ()
warnDefaulting wanteds default_ty
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index ed05e55a70..326e4bb0ec 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -911,10 +911,6 @@ zonkTidyOrigin env (KindEqOrigin ty1 ty2 orig)
; (env2, ty2') <- zonkTidyTcType env1 ty2
; (env3, orig') <- zonkTidyOrigin env2 orig
; return (env3, KindEqOrigin ty1' ty2' orig') }
-zonkTidyOrigin env (CoercibleOrigin ty1 ty2)
- = do { (env1, ty1') <- zonkTidyTcType env ty1
- ; (env2, ty2') <- zonkTidyTcType env1 ty2
- ; return (env2, CoercibleOrigin ty1' ty2') }
zonkTidyOrigin env (FunDepOrigin1 p1 l1 p2 l2)
= do { (env1, p1') <- zonkTidyTcType env p1
; (env2, p2') <- zonkTidyTcType env1 p2
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs
index cf7e39c88c..3ec6f2b584 100644
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/typecheck/TcRnTypes.hs
@@ -56,9 +56,9 @@ module TcRnTypes(
isCDictCan_Maybe, isCFunEqCan_maybe,
isCIrredEvCan, isCNonCanonical, isWantedCt, isDerivedCt,
isGivenCt, isHoleCt, isExprHoleCt, isTypeHoleCt,
- ctEvidence, ctLoc, ctPred, ctFlavour, ctEqRel,
+ ctEvidence, ctLoc, setCtLoc, ctPred, ctFlavour, ctEqRel, ctOrigin,
mkNonCanonical, mkNonCanonicalCt,
- ctEvPred, ctEvLoc, ctEvEqRel,
+ ctEvPred, ctEvLoc, ctEvOrigin, ctEvEqRel,
ctEvTerm, ctEvCoercion, ctEvId,
WantedConstraints(..), insolubleWC, emptyWC, isEmptyWC,
@@ -72,7 +72,7 @@ module TcRnTypes(
CtLoc(..), ctLocSpan, ctLocEnv, ctLocLevel, ctLocOrigin,
ctLocDepth, bumpCtLocDepth,
setCtLocOrigin, setCtLocEnv, setCtLocSpan,
- CtOrigin(..), pprCtOrigin,
+ CtOrigin(..), pprCtOrigin, pprCtLoc,
pushErrCtxt, pushErrCtxtSameOrigin,
SkolemInfo(..),
@@ -94,7 +94,6 @@ module TcRnTypes(
-- Pretty printing
pprEvVarTheta,
pprEvVars, pprEvVarWithType,
- pprArising, pprArisingAt,
-- Misc other types
TcId, TcIdSet, HoleSort(..)
@@ -1266,6 +1265,12 @@ ctEvidence = cc_ev
ctLoc :: Ct -> CtLoc
ctLoc = ctEvLoc . ctEvidence
+setCtLoc :: Ct -> CtLoc -> Ct
+setCtLoc ct loc = ct { cc_ev = (cc_ev ct) { ctev_loc = loc } }
+
+ctOrigin :: Ct -> CtOrigin
+ctOrigin = ctLocOrigin . ctLoc
+
ctPred :: Ct -> PredType
-- See Note [Ct/evidence invariant]
ctPred ct = ctEvPred (cc_ev ct)
@@ -1750,6 +1755,9 @@ ctEvPred = ctev_pred
ctEvLoc :: CtEvidence -> CtLoc
ctEvLoc = ctev_loc
+ctEvOrigin :: CtEvidence -> CtOrigin
+ctEvOrigin = ctLocOrigin . ctEvLoc
+
-- | Get the equality relation relevant for a 'CtEvidence'
ctEvEqRel :: CtEvidence -> EqRel
ctEvEqRel = predTypeEqRel . ctEvPred
@@ -2034,17 +2042,6 @@ pushErrCtxtSameOrigin :: ErrCtxt -> CtLoc -> CtLoc
pushErrCtxtSameOrigin err loc@(CtLoc { ctl_env = lcl })
= loc { ctl_env = lcl { tcl_ctxt = err : tcl_ctxt lcl } }
-pprArising :: CtOrigin -> SDoc
--- Used for the main, top-level error message
--- We've done special processing for TypeEq and FunDep origins
-pprArising (TypeEqOrigin {}) = empty
-pprArising orig = pprCtOrigin orig
-
-pprArisingAt :: CtLoc -> SDoc
-pprArisingAt (CtLoc { ctl_origin = o, ctl_env = lcl})
- = sep [ pprCtOrigin o
- , text "at" <+> ppr (tcl_loc lcl)]
-
{-
************************************************************************
* *
@@ -2174,7 +2171,6 @@ data CtOrigin
| KindEqOrigin
TcType TcType -- A kind equality arising from unifying these two types
CtOrigin -- originally arising from this
- | CoercibleOrigin TcType TcType -- a Coercible constraint
| IPOccOrigin HsIPName -- Occurrence of an implicit parameter
@@ -2227,11 +2223,19 @@ data CtOrigin
ctoHerald :: SDoc
ctoHerald = ptext (sLit "arising from")
-pprCtOrigin :: CtOrigin -> SDoc
+pprCtLoc :: CtLoc -> SDoc
+-- "arising from ... at ..."
+-- Not an instance of Outputable because of the "arising from" prefix
+pprCtLoc (CtLoc { ctl_origin = o, ctl_env = lcl})
+ = sep [ pprCtOrigin o
+ , text "at" <+> ppr (tcl_loc lcl)]
+pprCtOrigin :: CtOrigin -> SDoc
+-- "arising from ..."
+-- Not an instance of Outputable because of the "arising from" prefix
pprCtOrigin (GivenOrigin sk) = ctoHerald <+> ppr sk
-pprCtOrigin (SpecPragOrigin ctxt)
+pprCtOrigin (SpecPragOrigin ctxt)
= case ctxt of
FunSigCtxt n _ -> ptext (sLit "a SPECIALISE pragma for") <+> quotes (ppr n)
SpecInstCtxt -> ptext (sLit "a SPECIALISE INSTANCE pragma")
@@ -2239,13 +2243,13 @@ pprCtOrigin (SpecPragOrigin ctxt)
pprCtOrigin (FunDepOrigin1 pred1 loc1 pred2 loc2)
= hang (ctoHerald <+> ptext (sLit "a functional dependency between constraints:"))
- 2 (vcat [ hang (quotes (ppr pred1)) 2 (pprArisingAt loc1)
- , hang (quotes (ppr pred2)) 2 (pprArisingAt loc2) ])
+ 2 (vcat [ hang (quotes (ppr pred1)) 2 (pprCtLoc loc1)
+ , hang (quotes (ppr pred2)) 2 (pprCtLoc loc2) ])
pprCtOrigin (FunDepOrigin2 pred1 orig1 pred2 loc2)
= hang (ctoHerald <+> ptext (sLit "a functional dependency between:"))
2 (vcat [ hang (ptext (sLit "constraint") <+> quotes (ppr pred1))
- 2 (pprArising orig1 )
+ 2 (pprCtOrigin orig1 )
, hang (ptext (sLit "instance") <+> quotes (ppr pred2))
2 (ptext (sLit "at") <+> ppr loc2) ])
@@ -2268,11 +2272,6 @@ pprCtOrigin (DerivOriginCoerce meth ty1 ty2)
2 (sep [ text "from type" <+> quotes (ppr ty1)
, nest 2 $ text "to type" <+> quotes (ppr ty2) ])
-pprCtOrigin (CoercibleOrigin ty1 ty2)
- = hang (ctoHerald <+> text "trying to show that the representations of")
- 2 (quotes (ppr ty1) <+> text "and" $$
- quotes (ppr ty2) <+> text "are the same")
-
pprCtOrigin simple_origin
= ctoHerald <+> pprCtO simple_origin
diff --git a/testsuite/tests/deriving/should_fail/T4846.stderr b/testsuite/tests/deriving/should_fail/T4846.stderr
index b0ebb9edfb..5a7339bf21 100644
--- a/testsuite/tests/deriving/should_fail/T4846.stderr
+++ b/testsuite/tests/deriving/should_fail/T4846.stderr
@@ -1,10 +1,7 @@
-T4846.hs:29:1:
+T4846.hs:29:1: error:
Couldn't match type ‘Bool’ with ‘BOOL’
- arising from trying to show that the representations of
- ‘Expr Bool’ and
- ‘Expr BOOL’ are the same
- Relevant role signatures: type role Expr nominal
+ arising from a use of ‘coerce’
In the expression: coerce (mkExpr :: Expr Bool) :: Expr BOOL
In an equation for ‘mkExpr’:
mkExpr = coerce (mkExpr :: Expr Bool) :: Expr BOOL
diff --git a/testsuite/tests/deriving/should_fail/T5498.stderr b/testsuite/tests/deriving/should_fail/T5498.stderr
index ac91aaa4d0..ce87ef1867 100644
--- a/testsuite/tests/deriving/should_fail/T5498.stderr
+++ b/testsuite/tests/deriving/should_fail/T5498.stderr
@@ -1,11 +1,10 @@
-T5498.hs:30:39:
+T5498.hs:30:39: error:
Couldn't match representation of type ‘c a’
with that of ‘c (Down a)’
- arising from the coercion of the method ‘intIso’
- from type ‘forall (c :: * -> *). c a -> c Int’
- to type ‘forall (c :: * -> *). c (Down a) -> c Int’
- Relevant role signatures: type role Down representational
+ arising from the coercion of the method ‘intIso’
+ from type ‘forall (c :: * -> *). c a -> c Int’
+ to type ‘forall (c :: * -> *). c (Down a) -> c Int’
NB: We cannot know what roles the parameters to ‘c’ have;
we must assume that the role is nominal
When deriving the instance for (IntIso (Down a))
diff --git a/testsuite/tests/deriving/should_fail/T6147.stderr b/testsuite/tests/deriving/should_fail/T6147.stderr
index 7f851a656b..a7bd1ab477 100644
--- a/testsuite/tests/deriving/should_fail/T6147.stderr
+++ b/testsuite/tests/deriving/should_fail/T6147.stderr
@@ -1,7 +1,6 @@
-T6147.hs:13:32:
+T6147.hs:13:32: error:
Couldn't match type ‘Int’ with ‘Foo’
- arising from the coercion of the method ‘foo’
- from type ‘Int -> T Int’ to type ‘Foo -> T Foo’
- Relevant role signatures: type role T nominal
+ arising from the coercion of the method ‘foo’
+ from type ‘Int -> T Int’ to type ‘Foo -> T Foo’
When deriving the instance for (C Foo)
diff --git a/testsuite/tests/deriving/should_fail/T7148.stderr b/testsuite/tests/deriving/should_fail/T7148.stderr
index ba3a88b6fe..84c8205fb2 100644
--- a/testsuite/tests/deriving/should_fail/T7148.stderr
+++ b/testsuite/tests/deriving/should_fail/T7148.stderr
@@ -1,20 +1,14 @@
-T7148.hs:27:40:
+T7148.hs:27:40: error:
Occurs check: cannot construct the infinite type: b ~ Tagged a b
- arising from the coercion of the method ‘iso2’
- from type ‘forall b. SameType b () -> SameType b b’
- to type ‘forall b. SameType b () -> SameType b (Tagged a b)’
- Relevant role signatures:
- type role Tagged phantom representational
- type role SameType nominal nominal
+ arising from the coercion of the method ‘iso2’
+ from type ‘forall b. SameType b () -> SameType b b’
+ to type ‘forall b. SameType b () -> SameType b (Tagged a b)’
When deriving the instance for (IsoUnit (Tagged a b))
-T7148.hs:27:40:
+T7148.hs:27:40: error:
Occurs check: cannot construct the infinite type: b ~ Tagged a b
- arising from the coercion of the method ‘iso1’
- from type ‘forall b. SameType () b -> SameType b b’
- to type ‘forall b. SameType () b -> SameType (Tagged a b) b’
- Relevant role signatures:
- type role Tagged phantom representational
- type role SameType nominal nominal
+ arising from the coercion of the method ‘iso1’
+ from type ‘forall b. SameType () b -> SameType b b’
+ to type ‘forall b. SameType () b -> SameType (Tagged a b) b’
When deriving the instance for (IsoUnit (Tagged a b))
diff --git a/testsuite/tests/deriving/should_fail/T7148a.stderr b/testsuite/tests/deriving/should_fail/T7148a.stderr
index 4edb968702..8dd23aa034 100644
--- a/testsuite/tests/deriving/should_fail/T7148a.stderr
+++ b/testsuite/tests/deriving/should_fail/T7148a.stderr
@@ -1,14 +1,10 @@
-T7148a.hs:19:50:
+T7148a.hs:19:50: error:
Couldn't match representation of type ‘b’ with that of ‘Result a b’
- ‘b’ is a rigid type variable bound by
- the type forall b1. Proxy b1 -> a -> Result a b1 at T7148a.hs:19:50
- arising from the coercion of the method ‘coerce’
- from type ‘forall b. Proxy b -> a -> Result a b’
- to type ‘forall b.
- Proxy b -> IS_NO_LONGER a -> Result (IS_NO_LONGER a) b’
- Relevant role signatures:
- type role IS_NO_LONGER representational
- type role Result nominal nominal
- type role Proxy phantom
+ arising from the coercion of the method ‘coerce’
+ from type ‘forall b. Proxy b -> a -> Result a b’
+ to type ‘forall b.
+ Proxy b -> IS_NO_LONGER a -> Result (IS_NO_LONGER a) b’
+ ‘b’ is a rigid type variable bound by
+ the type forall b1. Proxy b1 -> a -> Result a b1 at T7148a.hs:19:50
When deriving the instance for (Convert (IS_NO_LONGER a))
diff --git a/testsuite/tests/deriving/should_fail/T8851.stderr b/testsuite/tests/deriving/should_fail/T8851.stderr
index 0a2b384bd1..dd4a614785 100644
--- a/testsuite/tests/deriving/should_fail/T8851.stderr
+++ b/testsuite/tests/deriving/should_fail/T8851.stderr
@@ -1,16 +1,11 @@
-T8851.hs:24:12:
+T8851.hs:24:12: error:
Couldn't match type ‘Parser’ with ‘MyParser’
- arising from the coercion of the method ‘notFollowedBy’
- from type ‘forall a.
- (Monad Parser, Show a) =>
- Parser a -> Parser ()’
- to type ‘forall a.
- (Monad MyParser, Show a) =>
- MyParser a -> MyParser ()’
- Relevant role signatures:
- type role Monad nominal
- type role Show nominal
- type role MyParser phantom
- type role Parser phantom
+ arising from the coercion of the method ‘notFollowedBy’
+ from type ‘forall a.
+ (Monad Parser, Show a) =>
+ Parser a -> Parser ()’
+ to type ‘forall a.
+ (Monad MyParser, Show a) =>
+ MyParser a -> MyParser ()’
When deriving the instance for (Parsing MyParser)
diff --git a/testsuite/tests/deriving/should_fail/T8984.stderr b/testsuite/tests/deriving/should_fail/T8984.stderr
index 6606d66f63..1cdc425293 100644
--- a/testsuite/tests/deriving/should_fail/T8984.stderr
+++ b/testsuite/tests/deriving/should_fail/T8984.stderr
@@ -1,11 +1,9 @@
-T8984.hs:7:46:
+T8984.hs:7:46: error:
Couldn't match representation of type ‘cat a (N cat a Int)’
with that of ‘cat a (cat a Int)’
- arising from the coercion of the method ‘app’
- from type ‘cat a (cat a Int)’ to type ‘N cat a (N cat a Int)’
- Relevant role signatures:
- type role N representational nominal nominal
+ arising from the coercion of the method ‘app’
+ from type ‘cat a (cat a Int)’ to type ‘N cat a (N cat a Int)’
NB: We cannot know what roles the parameters to ‘cat a’ have;
we must assume that the role is nominal
When deriving the instance for (C (N cat a))
diff --git a/testsuite/tests/gadt/CasePrune.stderr b/testsuite/tests/gadt/CasePrune.stderr
index 1202d1b04e..c3d89e885c 100644
--- a/testsuite/tests/gadt/CasePrune.stderr
+++ b/testsuite/tests/gadt/CasePrune.stderr
@@ -1,7 +1,6 @@
-CasePrune.hs:14:31:
+CasePrune.hs:14:31: error:
Couldn't match type ‘Int’ with ‘A’
- arising from the coercion of the method ‘ic’
- from type ‘T Int’ to type ‘T A’
- Relevant role signatures: type role T nominal
+ arising from the coercion of the method ‘ic’
+ from type ‘T Int’ to type ‘T A’
When deriving the instance for (C A)
diff --git a/testsuite/tests/ghci/scripts/Defer02.stderr b/testsuite/tests/ghci/scripts/Defer02.stderr
index 69e098a883..a3a3e9d061 100644
--- a/testsuite/tests/ghci/scripts/Defer02.stderr
+++ b/testsuite/tests/ghci/scripts/Defer02.stderr
@@ -1,5 +1,5 @@
-../../typecheck/should_run/Defer01.hs:11:40: Warning:
+../../typecheck/should_run/Defer01.hs:11:40: warning:
Couldn't match type ‘Char’ with ‘[Char]’
Expected type: String
Actual type: Char
@@ -7,17 +7,17 @@
In the second argument of ‘(>>)’, namely ‘putStr ','’
In the expression: putStr "Hello World" >> putStr ','
-../../typecheck/should_run/Defer01.hs:14:5: Warning:
+../../typecheck/should_run/Defer01.hs:14:5: warning:
Couldn't match expected type ‘Int’ with actual type ‘Char’
In the expression: 'p'
In an equation for ‘a’: a = 'p'
-../../typecheck/should_run/Defer01.hs:18:9: Warning:
+../../typecheck/should_run/Defer01.hs:18:9: warning:
No instance for (Eq B) arising from a use of ‘==’
In the expression: x == x
In an equation for ‘b’: b x = x == x
-../../typecheck/should_run/Defer01.hs:25:4: Warning:
+../../typecheck/should_run/Defer01.hs:25:4: warning:
Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
a pattern with constructor: C2 :: Bool -> C Bool,
@@ -25,14 +25,14 @@
In the pattern: C2 x
In an equation for ‘c’: c (C2 x) = True
-../../typecheck/should_run/Defer01.hs:28:5: Warning:
+../../typecheck/should_run/Defer01.hs:28:5: warning:
No instance for (Num (a -> a))
(maybe you haven't applied a function to enough arguments?)
arising from the literal ‘1’
In the expression: 1
In an equation for ‘d’: d = 1
-../../typecheck/should_run/Defer01.hs:31:5: Warning:
+../../typecheck/should_run/Defer01.hs:31:5: warning:
Couldn't match expected type ‘Char -> t’ with actual type ‘Char’
Relevant bindings include
f :: t (bound at ../../typecheck/should_run/Defer01.hs:31:1)
@@ -41,11 +41,11 @@
In the expression: e 'q'
In an equation for ‘f’: f = e 'q'
-../../typecheck/should_run/Defer01.hs:34:8: Warning:
+../../typecheck/should_run/Defer01.hs:34:8: warning:
Couldn't match expected type ‘Char’ with actual type ‘a’
- ‘a’ is a rigid type variable bound by
- the type signature for: h :: a -> (Char, Char)
- at ../../typecheck/should_run/Defer01.hs:33:6
+ ‘a’ is a rigid type variable bound by
+ the type signature for: h :: a -> (Char, Char)
+ at ../../typecheck/should_run/Defer01.hs:33:6
Relevant bindings include
x :: a (bound at ../../typecheck/should_run/Defer01.hs:34:3)
h :: a -> (Char, Char)
@@ -53,7 +53,7 @@
In the expression: x
In the expression: (x, 'c')
-../../typecheck/should_run/Defer01.hs:39:17: Warning:
+../../typecheck/should_run/Defer01.hs:39:17: warning:
Couldn't match expected type ‘Bool’ with actual type ‘T a’
Relevant bindings include
a :: a (bound at ../../typecheck/should_run/Defer01.hs:39:3)
@@ -61,12 +61,12 @@
In the first argument of ‘not’, namely ‘(K a)’
In the expression: (not (K a))
-../../typecheck/should_run/Defer01.hs:43:5: Warning:
+../../typecheck/should_run/Defer01.hs:43:5: warning:
No instance for (MyClass a1) arising from a use of ‘myOp’
In the expression: myOp 23
In an equation for ‘j’: j = myOp 23
-../../typecheck/should_run/Defer01.hs:43:10: Warning:
+../../typecheck/should_run/Defer01.hs:43:10: warning:
No instance for (Num a1) arising from the literal ‘23’
The type variable ‘a1’ is ambiguous
Note: there are several potential instances:
@@ -78,7 +78,7 @@
In the expression: myOp 23
In an equation for ‘j’: j = myOp 23
-../../typecheck/should_run/Defer01.hs:45:6: Warning:
+../../typecheck/should_run/Defer01.hs:45:6: warning:
Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
the type signature for: k :: (Int ~ Bool) => Int -> Bool
@@ -87,30 +87,30 @@
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool
-../../typecheck/should_run/Defer01.hs:45:6: Warning:
+../../typecheck/should_run/Defer01.hs:45:6: warning:
Couldn't match expected type ‘Bool’ with actual type ‘Int’
In the ambiguity check for the type signature for ‘k’:
k :: (Int ~ Bool) => Int -> Bool
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool
-../../typecheck/should_run/Defer01.hs:45:6: Warning:
+../../typecheck/should_run/Defer01.hs:45:6: warning:
Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
the type signature for: k :: (Int ~ Bool) => Int -> Bool
-../../typecheck/should_run/Defer01.hs:46:7: Warning:
+../../typecheck/should_run/Defer01.hs:46:7: warning:
Couldn't match expected type ‘Bool’ with actual type ‘Int’
In the expression: x
In an equation for ‘k’: k x = x
-../../typecheck/should_run/Defer01.hs:49:5: Warning:
+../../typecheck/should_run/Defer01.hs:49:5: warning:
Couldn't match expected type ‘IO a0’
with actual type ‘Char -> IO ()’
Probable cause: ‘putChar’ is applied to too few arguments
In the first argument of ‘(>>)’, namely ‘putChar’
In the expression: putChar >> putChar 'p'
-*** Exception: ../../typecheck/should_run/Defer01.hs:11:40:
+*** Exception: ../../typecheck/should_run/Defer01.hs:11:40: error:
Couldn't match type ‘Char’ with ‘[Char]’
Expected type: String
Actual type: Char
@@ -118,31 +118,31 @@
In the second argument of ‘(>>)’, namely ‘putStr ','’
In the expression: putStr "Hello World" >> putStr ','
(deferred type error)
-*** Exception: ../../typecheck/should_run/Defer01.hs:14:5:
+*** Exception: ../../typecheck/should_run/Defer01.hs:14:5: error:
Couldn't match expected type ‘Int’ with actual type ‘Char’
In the expression: 'p'
In an equation for ‘a’: a = 'p'
(deferred type error)
-*** Exception: ../../typecheck/should_run/Defer01.hs:18:9:
+*** Exception: ../../typecheck/should_run/Defer01.hs:18:9: error:
No instance for (Eq B) arising from a use of ‘==’
In the expression: x == x
In an equation for ‘b’: b x = x == x
(deferred type error)
-<interactive>:8:11:
+<interactive>:8:11: error:
Couldn't match type ‘Bool’ with ‘Int’
Expected type: C Int
Actual type: C Bool
In the first argument of ‘c’, namely ‘(C2 True)’
In the first argument of ‘print’, namely ‘(c (C2 True))’
-*** Exception: ../../typecheck/should_run/Defer01.hs:28:5:
+*** Exception: ../../typecheck/should_run/Defer01.hs:28:5: error:
No instance for (Num (a -> a))
(maybe you haven't applied a function to enough arguments?)
arising from the literal ‘1’
In the expression: 1
In an equation for ‘d’: d = 1
(deferred type error)
-*** Exception: ../../typecheck/should_run/Defer01.hs:31:5:
+*** Exception: ../../typecheck/should_run/Defer01.hs:31:5: error:
Couldn't match expected type ‘Char -> t’ with actual type ‘Char’
Relevant bindings include
f :: t (bound at ../../typecheck/should_run/Defer01.hs:31:1)
@@ -151,11 +151,11 @@
In the expression: e 'q'
In an equation for ‘f’: f = e 'q'
(deferred type error)
-*** Exception: ../../typecheck/should_run/Defer01.hs:34:8:
+*** Exception: ../../typecheck/should_run/Defer01.hs:34:8: error:
Couldn't match expected type ‘Char’ with actual type ‘a’
- ‘a’ is a rigid type variable bound by
- the type signature for: h :: a -> (Char, Char)
- at ../../typecheck/should_run/Defer01.hs:33:6
+ ‘a’ is a rigid type variable bound by
+ the type signature for: h :: a -> (Char, Char)
+ at ../../typecheck/should_run/Defer01.hs:33:6
Relevant bindings include
x :: a (bound at ../../typecheck/should_run/Defer01.hs:34:3)
h :: a -> (Char, Char)
@@ -163,7 +163,7 @@
In the expression: x
In the expression: (x, 'c')
(deferred type error)
-*** Exception: ../../typecheck/should_run/Defer01.hs:39:17:
+*** Exception: ../../typecheck/should_run/Defer01.hs:39:17: error:
Couldn't match expected type ‘Bool’ with actual type ‘T a’
Relevant bindings include
a :: a (bound at ../../typecheck/should_run/Defer01.hs:39:3)
@@ -171,18 +171,18 @@
In the first argument of ‘not’, namely ‘(K a)’
In the expression: (not (K a))
(deferred type error)
-*** Exception: ../../typecheck/should_run/Defer01.hs:43:5:
+*** Exception: ../../typecheck/should_run/Defer01.hs:43:5: error:
No instance for (MyClass a1) arising from a use of ‘myOp’
In the expression: myOp 23
In an equation for ‘j’: j = myOp 23
(deferred type error)
-<interactive>:14:8:
+<interactive>:14:8: error:
Couldn't match expected type ‘Bool’ with actual type ‘Int’
In the first argument of ‘print’, namely ‘(k 2)’
In the expression: print (k 2)
In an equation for ‘it’: it = print (k 2)
-*** Exception: ../../typecheck/should_run/Defer01.hs:49:5:
+*** Exception: ../../typecheck/should_run/Defer01.hs:49:5: error:
Couldn't match expected type ‘IO a0’
with actual type ‘Char -> IO ()’
Probable cause: ‘putChar’ is applied to too few arguments
diff --git a/testsuite/tests/ghci/scripts/T8649.stderr b/testsuite/tests/ghci/scripts/T8649.stderr
index 1fe41defdc..257b112112 100644
--- a/testsuite/tests/ghci/scripts/T8649.stderr
+++ b/testsuite/tests/ghci/scripts/T8649.stderr
@@ -1,8 +1,8 @@
-<interactive>:5:4:
+<interactive>:5:4: error:
Couldn't match expected type ‘Ghci1.X’
with actual type ‘X’
- NB: ‘Ghci1.X’ is defined at <interactive>:2:1-14
- ‘X’ is defined at <interactive>:4:1-25
+ NB: ‘X’ is defined at <interactive>:4:1-25
+ ‘Ghci1.X’ is defined at <interactive>:2:1-14
In the first argument of ‘f’, namely ‘(Y 3)’
In the expression: f (Y 3)
diff --git a/testsuite/tests/ghci/scripts/ghci050.stderr b/testsuite/tests/ghci/scripts/ghci050.stderr
index 4c8de9da4e..d1df9b8379 100644
--- a/testsuite/tests/ghci/scripts/ghci050.stderr
+++ b/testsuite/tests/ghci/scripts/ghci050.stderr
@@ -1,9 +1,9 @@
-<interactive>:6:49:
+<interactive>:6:49: error:
Couldn't match expected type ‘ListableElem (a, a)’
with actual type ‘a’
- ‘a’ is a rigid type variable bound by
- the instance declaration at <interactive>:6:10
+ ‘a’ is a rigid type variable bound by
+ the instance declaration at <interactive>:6:10
Relevant bindings include
b :: a (bound at <interactive>:6:43)
a :: a (bound at <interactive>:6:41)
diff --git a/testsuite/tests/ghci/scripts/ghci051.stderr b/testsuite/tests/ghci/scripts/ghci051.stderr
index 3b6ad44d93..2a528e847a 100644
--- a/testsuite/tests/ghci/scripts/ghci051.stderr
+++ b/testsuite/tests/ghci/scripts/ghci051.stderr
@@ -1,9 +1,9 @@
-<interactive>:7:9:
+<interactive>:7:9: error:
Couldn't match type ‘T’
with ‘Ghci1.T’
- NB: ‘T’ is defined at <interactive>:6:1-16
- ‘Ghci1.T’ is defined at <interactive>:3:1-14
+ NB: ‘Ghci1.T’ is defined at <interactive>:3:1-14
+ ‘T’ is defined at <interactive>:6:1-16
Expected type: T'
Actual type: T
In the expression: C :: T'
diff --git a/testsuite/tests/ghci/scripts/ghci052.stderr b/testsuite/tests/ghci/scripts/ghci052.stderr
index b2b0c7613b..ce221887d6 100644
--- a/testsuite/tests/ghci/scripts/ghci052.stderr
+++ b/testsuite/tests/ghci/scripts/ghci052.stderr
@@ -1,32 +1,32 @@
-<interactive>:9:4:
+<interactive>:9:4: error:
Couldn't match expected type ‘Ghci1.Planet’
with actual type ‘Planet’
- NB: ‘Ghci1.Planet’ is defined at <interactive>:5:1-37
- ‘Planet’ is defined at <interactive>:8:1-36
+ NB: ‘Planet’ is defined at <interactive>:8:1-36
+ ‘Ghci1.Planet’ is defined at <interactive>:5:1-37
In the first argument of ‘pn’, namely ‘Mercury’
In the expression: pn Mercury
-<interactive>:10:4:
+<interactive>:10:4: error:
Couldn't match expected type ‘Ghci1.Planet’
with actual type ‘Planet’
- NB: ‘Ghci1.Planet’ is defined at <interactive>:5:1-37
- ‘Planet’ is defined at <interactive>:8:1-36
+ NB: ‘Planet’ is defined at <interactive>:8:1-36
+ ‘Ghci1.Planet’ is defined at <interactive>:5:1-37
In the first argument of ‘pn’, namely ‘Venus’
In the expression: pn Venus
-<interactive>:11:4:
+<interactive>:11:4: error:
Couldn't match expected type ‘Ghci1.Planet’
with actual type ‘Planet’
- NB: ‘Ghci1.Planet’ is defined at <interactive>:5:1-37
- ‘Planet’ is defined at <interactive>:8:1-36
+ NB: ‘Planet’ is defined at <interactive>:8:1-36
+ ‘Ghci1.Planet’ is defined at <interactive>:5:1-37
In the first argument of ‘pn’, namely ‘Mars’
In the expression: pn Mars
-<interactive>:13:44:
+<interactive>:13:44: error:
Couldn't match expected type ‘Planet’
with actual type ‘Ghci1.Planet’
- NB: ‘Planet’ is defined at <interactive>:8:1-36
- ‘Ghci1.Planet’ is defined at <interactive>:5:1-37
+ NB: ‘Ghci1.Planet’ is defined at <interactive>:5:1-37
+ ‘Planet’ is defined at <interactive>:8:1-36
In the pattern: Earth
In an equation for ‘pn’: pn Earth = "E"
diff --git a/testsuite/tests/ghci/scripts/ghci053.stderr b/testsuite/tests/ghci/scripts/ghci053.stderr
index 2d91a51d21..fe6d6c9bef 100644
--- a/testsuite/tests/ghci/scripts/ghci053.stderr
+++ b/testsuite/tests/ghci/scripts/ghci053.stderr
@@ -1,16 +1,16 @@
-<interactive>:10:12:
+<interactive>:10:12: error:
Couldn't match expected type ‘Ghci1.Planet’
with actual type ‘Planet’
- NB: ‘Ghci1.Planet’ is defined at <interactive>:5:1-49
- ‘Planet’ is defined at <interactive>:8:1-41
+ NB: ‘Planet’ is defined at <interactive>:8:1-41
+ ‘Ghci1.Planet’ is defined at <interactive>:5:1-49
In the second argument of ‘(==)’, namely ‘Mercury’
In the expression: mercury == Mercury
-<interactive>:12:10:
+<interactive>:12:10: error:
Couldn't match expected type ‘Planet’
with actual type ‘Ghci1.Planet’
- NB: ‘Planet’ is defined at <interactive>:8:1-41
- ‘Ghci1.Planet’ is defined at <interactive>:5:1-49
+ NB: ‘Ghci1.Planet’ is defined at <interactive>:5:1-49
+ ‘Planet’ is defined at <interactive>:8:1-41
In the second argument of ‘(==)’, namely ‘Earth’
In the expression: Venus == Earth
diff --git a/testsuite/tests/indexed-types/should_fail/T6088.stderr b/testsuite/tests/indexed-types/should_fail/T6088.stderr
index 221dd32920..c910ec60d6 100644
--- a/testsuite/tests/indexed-types/should_fail/T6088.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T6088.stderr
@@ -1,4 +1,5 @@
-T6088.hs:16:33:
+T6088.hs:16:33: error:
Couldn't match type ‘Pos n’ with ‘True’
+ arising from the 'deriving' clause of a data type declaration
When deriving the instance for (C (B n))
diff --git a/testsuite/tests/indexed-types/should_fail/T9580.stderr b/testsuite/tests/indexed-types/should_fail/T9580.stderr
index e2b7eb0991..5612906f84 100644
--- a/testsuite/tests/indexed-types/should_fail/T9580.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T9580.stderr
@@ -1,11 +1,11 @@
-[1 of 2] Compiling T9580a ( T9580a.hs, T9580a.o )
-[2 of 2] Compiling T9580 ( T9580.hs, T9580.o )
-
-T9580.hs:7:9:
- Couldn't match representation of type ‘Dimensional Int Double’
- with that of ‘Double’
- Relevant role signatures: type role Dimensional nominal nominal
- The data constructor ‘T9580a.Quantity'’
- of newtype ‘Dimensional Int v’ is not in scope
- In the expression: coerce x
- In an equation for ‘foo’: foo x = coerce x
+[1 of 2] Compiling T9580a ( T9580a.hs, T9580a.o )
+[2 of 2] Compiling T9580 ( T9580.hs, T9580.o )
+
+T9580.hs:7:9: error:
+ Couldn't match representation of type ‘Dimensional Int Double’
+ with that of ‘Double’
+ arising from a use of ‘coerce’
+ The data constructor ‘T9580a.Quantity'’
+ of newtype ‘Dimensional Int v’ is not in scope
+ In the expression: coerce x
+ In an equation for ‘foo’: foo x = coerce x
diff --git a/testsuite/tests/module/mod180.stderr b/testsuite/tests/module/mod180.stderr
index 732b5c8d0d..f76cfc8480 100644
--- a/testsuite/tests/module/mod180.stderr
+++ b/testsuite/tests/module/mod180.stderr
@@ -1,8 +1,8 @@
-mod180.hs:8:5:
+mod180.hs:8:5: error:
Couldn't match expected type ‘T’
with actual type ‘main:Mod180_A.T’
- NB: ‘T’ is defined at Mod180_B.hs:3:1-10
- ‘main:Mod180_A.T’ is defined at Mod180_A.hs:3:1-10
+ NB: ‘main:Mod180_A.T’ is defined at Mod180_A.hs:3:1-10
+ ‘T’ is defined at Mod180_B.hs:3:1-10
In the expression: x
In an equation for ‘z’: z = x
diff --git a/testsuite/tests/polykinds/T7438.stderr b/testsuite/tests/polykinds/T7438.stderr
index 8ef9ef8f33..d45bec1851 100644
--- a/testsuite/tests/polykinds/T7438.stderr
+++ b/testsuite/tests/polykinds/T7438.stderr
@@ -1,5 +1,5 @@
-T7438.hs:6:14:
+T7438.hs:6:14: error:
Couldn't match expected type ‘t1’ with actual type ‘t’
‘t’ is untouchable
inside the constraints: t2 ~ t3
@@ -7,10 +7,10 @@ T7438.hs:6:14:
Nil :: forall (k :: BOX) (b :: k). Thrist b b,
in an equation for ‘go’
at T7438.hs:6:4-6
- ‘t’ is a rigid type variable bound by
- the inferred type of go :: Thrist t2 t3 -> t -> t1 at T7438.hs:6:1
- ‘t1’ is a rigid type variable bound by
- the inferred type of go :: Thrist t2 t3 -> t -> t1 at T7438.hs:6:1
+ ‘t’ is a rigid type variable bound by
+ the inferred type of go :: Thrist t2 t3 -> t -> t1 at T7438.hs:6:1
+ ‘t1’ is a rigid type variable bound by
+ the inferred type of go :: Thrist t2 t3 -> t -> t1 at T7438.hs:6:1
Possible fix: add a type signature for ‘go’
Relevant bindings include
acc :: t (bound at T7438.hs:6:8)
diff --git a/testsuite/tests/roles/should_fail/Roles10.stderr b/testsuite/tests/roles/should_fail/Roles10.stderr
index 4434352652..bc61e22de1 100644
--- a/testsuite/tests/roles/should_fail/Roles10.stderr
+++ b/testsuite/tests/roles/should_fail/Roles10.stderr
@@ -1,7 +1,6 @@
-Roles10.hs:16:12:
+Roles10.hs:16:12: error:
Couldn't match representation of type ‘Bool’ with that of ‘Char’
- arising from the coercion of the method ‘meth’
- from type ‘Int -> F Int’ to type ‘Age -> F Age’
- Relevant role signatures: type role F nominal
+ arising from the coercion of the method ‘meth’
+ from type ‘Int -> F Int’ to type ‘Age -> F Age’
When deriving the instance for (C Age)
diff --git a/testsuite/tests/roles/should_fail/RolesIArray.stderr b/testsuite/tests/roles/should_fail/RolesIArray.stderr
index fa9e8fe57f..8b844dc3eb 100644
--- a/testsuite/tests/roles/should_fail/RolesIArray.stderr
+++ b/testsuite/tests/roles/should_fail/RolesIArray.stderr
@@ -1,93 +1,63 @@
-RolesIArray.hs:10:13:
+RolesIArray.hs:10:13: error:
Couldn't match type ‘Word64’ with ‘N’
- arising from the coercion of the method ‘Data.Array.Base.unsafeAccumArray’
- from type ‘forall e' i.
- Ix i =>
- (Word64 -> e' -> Word64)
- -> Word64 -> (i, i) -> [(Int, e')] -> UArray i Word64’
- to type ‘forall e' i.
- Ix i =>
- (N -> e' -> N) -> N -> (i, i) -> [(Int, e')] -> UArray i N’
- Relevant role signatures:
- type role Ix nominal
- type role [] representational
- type role (,) representational representational
- type role UArray nominal nominal
+ arising from the coercion of the method ‘Data.Array.Base.unsafeAccumArray’
+ from type ‘forall e' i.
+ Ix i =>
+ (Word64 -> e' -> Word64)
+ -> Word64 -> (i, i) -> [(Int, e')] -> UArray i Word64’
+ to type ‘forall e' i.
+ Ix i =>
+ (N -> e' -> N) -> N -> (i, i) -> [(Int, e')] -> UArray i N’
When deriving the instance for (IArray UArray N)
-RolesIArray.hs:10:13:
+RolesIArray.hs:10:13: error:
Couldn't match type ‘Word64’ with ‘N’
- arising from the coercion of the method ‘Data.Array.Base.unsafeAccum’
- from type ‘forall e' i.
- Ix i =>
- (Word64 -> e' -> Word64)
- -> UArray i Word64 -> [(Int, e')] -> UArray i Word64’
- to type ‘forall e' i.
- Ix i =>
- (N -> e' -> N) -> UArray i N -> [(Int, e')] -> UArray i N’
- Relevant role signatures:
- type role Ix nominal
- type role [] representational
- type role (,) representational representational
- type role UArray nominal nominal
+ arising from the coercion of the method ‘Data.Array.Base.unsafeAccum’
+ from type ‘forall e' i.
+ Ix i =>
+ (Word64 -> e' -> Word64)
+ -> UArray i Word64 -> [(Int, e')] -> UArray i Word64’
+ to type ‘forall e' i.
+ Ix i =>
+ (N -> e' -> N) -> UArray i N -> [(Int, e')] -> UArray i N’
When deriving the instance for (IArray UArray N)
-RolesIArray.hs:10:13:
+RolesIArray.hs:10:13: error:
Couldn't match type ‘Word64’ with ‘N’
- arising from the coercion of the method ‘Data.Array.Base.unsafeReplace’
- from type ‘forall i.
- Ix i =>
- UArray i Word64 -> [(Int, Word64)] -> UArray i Word64’
- to type ‘forall i. Ix i => UArray i N -> [(Int, N)] -> UArray i N’
- Relevant role signatures:
- type role Ix nominal
- type role [] representational
- type role (,) representational representational
- type role UArray nominal nominal
+ arising from the coercion of the method ‘Data.Array.Base.unsafeReplace’
+ from type ‘forall i.
+ Ix i =>
+ UArray i Word64 -> [(Int, Word64)] -> UArray i Word64’
+ to type ‘forall i. Ix i => UArray i N -> [(Int, N)] -> UArray i N’
When deriving the instance for (IArray UArray N)
-RolesIArray.hs:10:13:
+RolesIArray.hs:10:13: error:
Couldn't match type ‘Word64’ with ‘N’
- arising from the coercion of the method ‘Data.Array.Base.unsafeAt’
- from type ‘forall i. Ix i => UArray i Word64 -> Int -> Word64’
- to type ‘forall i. Ix i => UArray i N -> Int -> N’
- Relevant role signatures:
- type role Ix nominal
- type role UArray nominal nominal
+ arising from the coercion of the method ‘Data.Array.Base.unsafeAt’
+ from type ‘forall i. Ix i => UArray i Word64 -> Int -> Word64’
+ to type ‘forall i. Ix i => UArray i N -> Int -> N’
When deriving the instance for (IArray UArray N)
-RolesIArray.hs:10:13:
+RolesIArray.hs:10:13: error:
Couldn't match type ‘Word64’ with ‘N’
- arising from the coercion of the method ‘Data.Array.Base.unsafeArray’
- from type ‘forall i.
- Ix i =>
- (i, i) -> [(Int, Word64)] -> UArray i Word64’
- to type ‘forall i. Ix i => (i, i) -> [(Int, N)] -> UArray i N’
- Relevant role signatures:
- type role Ix nominal
- type role [] representational
- type role (,) representational representational
- type role UArray nominal nominal
+ arising from the coercion of the method ‘Data.Array.Base.unsafeArray’
+ from type ‘forall i.
+ Ix i =>
+ (i, i) -> [(Int, Word64)] -> UArray i Word64’
+ to type ‘forall i. Ix i => (i, i) -> [(Int, N)] -> UArray i N’
When deriving the instance for (IArray UArray N)
-RolesIArray.hs:10:13:
+RolesIArray.hs:10:13: error:
Couldn't match type ‘Word64’ with ‘N’
- arising from the coercion of the method ‘Data.Array.Base.numElements’
- from type ‘forall i. Ix i => UArray i Word64 -> Int’
- to type ‘forall i. Ix i => UArray i N -> Int’
- Relevant role signatures:
- type role Ix nominal
- type role UArray nominal nominal
+ arising from the coercion of the method ‘Data.Array.Base.numElements’
+ from type ‘forall i. Ix i => UArray i Word64 -> Int’
+ to type ‘forall i. Ix i => UArray i N -> Int’
When deriving the instance for (IArray UArray N)
-RolesIArray.hs:10:13:
+RolesIArray.hs:10:13: error:
Couldn't match type ‘Word64’ with ‘N’
- arising from the coercion of the method ‘bounds’
- from type ‘forall i. Ix i => UArray i Word64 -> (i, i)’
- to type ‘forall i. Ix i => UArray i N -> (i, i)’
- Relevant role signatures:
- type role Ix nominal
- type role (,) representational representational
- type role UArray nominal nominal
+ arising from the coercion of the method ‘bounds’
+ from type ‘forall i. Ix i => UArray i Word64 -> (i, i)’
+ to type ‘forall i. Ix i => UArray i N -> (i, i)’
When deriving the instance for (IArray UArray N)
diff --git a/testsuite/tests/typecheck/bug1465/bug1465.stderr b/testsuite/tests/typecheck/bug1465/bug1465.stderr
index 118d070075..1c67068762 100644
--- a/testsuite/tests/typecheck/bug1465/bug1465.stderr
+++ b/testsuite/tests/typecheck/bug1465/bug1465.stderr
@@ -1,8 +1,8 @@
-C.hs:6:11:
+C.hs:6:11: error:
Couldn't match expected type ‘bug1465-1.0:A.T’
with actual type ‘A.T’
- NB: ‘bug1465-1.0:A.T’ is defined in ‘A’ in package ‘bug1465-1.0’
- ‘A.T’ is defined in ‘A’ in package ‘bug1465-2.0’
+ NB: ‘A.T’ is defined in ‘A’ in package ‘bug1465-2.0’
+ ‘bug1465-1.0:A.T’ is defined in ‘A’ in package ‘bug1465-1.0’
In the expression: B2.f
In the expression: [B1.f, B2.f]
diff --git a/testsuite/tests/typecheck/should_compile/FD3.stderr b/testsuite/tests/typecheck/should_compile/FD3.stderr
index 179fda19e6..f4c60451d8 100644
--- a/testsuite/tests/typecheck/should_compile/FD3.stderr
+++ b/testsuite/tests/typecheck/should_compile/FD3.stderr
@@ -1,5 +1,14 @@
FD3.hs:15:15: error:
- No instance for (MkA (String, a) a) arising from a use of ‘mkA’
+ Couldn't match type ‘a’ with ‘(String, a)’
+ arising from a functional dependency between:
+ constraint ‘MkA (String, a) a’ arising from a use of ‘mkA’
+ instance ‘MkA a1 a1’ at FD3.hs:12:10-16
+ ‘a’ is a rigid type variable bound by
+ the type signature for: translate :: (String, a) -> A a
+ at FD3.hs:14:14
+ Relevant bindings include
+ a :: (String, a) (bound at FD3.hs:15:11)
+ translate :: (String, a) -> A a (bound at FD3.hs:15:1)
In the expression: mkA a
In an equation for ‘translate’: translate a = mkA a
diff --git a/testsuite/tests/typecheck/should_fail/T10285.stderr b/testsuite/tests/typecheck/should_fail/T10285.stderr
index 1ed2046278..8a13daeae2 100644
--- a/testsuite/tests/typecheck/should_fail/T10285.stderr
+++ b/testsuite/tests/typecheck/should_fail/T10285.stderr
@@ -1,9 +1,6 @@
T10285.hs:8:17: error:
- Could not deduce: Coercible a b
- arising from trying to show that the representations of
- ‘a’ and
- ‘b’ are the same
+ Could not deduce: Coercible a b arising from a use of ‘coerce’
from the context: Coercible (N a) (N b)
bound by a pattern with constructor:
Coercion :: forall (k :: BOX) (a :: k) (b :: k).
diff --git a/testsuite/tests/typecheck/should_fail/T10495.stderr b/testsuite/tests/typecheck/should_fail/T10495.stderr
index 6e92505504..eec1cdb7c0 100644
--- a/testsuite/tests/typecheck/should_fail/T10495.stderr
+++ b/testsuite/tests/typecheck/should_fail/T10495.stderr
@@ -1,6 +1,7 @@
T10495.hs:5:7: error:
Couldn't match representation of type ‘a0’ with that of ‘b0’
+ arising from a use of ‘coerce’
Relevant bindings include foo :: a0 -> b0 (bound at T10495.hs:5:1)
In the expression: coerce
In an equation for ‘foo’: foo = coerce
diff --git a/testsuite/tests/typecheck/should_fail/T10534.stderr b/testsuite/tests/typecheck/should_fail/T10534.stderr
index ab2cde1cf5..5bb0e40097 100644
--- a/testsuite/tests/typecheck/should_fail/T10534.stderr
+++ b/testsuite/tests/typecheck/should_fail/T10534.stderr
@@ -1,9 +1,6 @@
T10534a.hs:10:9: error:
- Could not deduce: Coercible a b
- arising from trying to show that the representations of
- ‘a’ and
- ‘b’ are the same
+ Could not deduce: Coercible a b arising from a use of ‘coerce’
from the context: Coercible (DF a) (DF b)
bound by the type signature for:
silly :: Coercible (DF a) (DF b) => a -> b
diff --git a/testsuite/tests/typecheck/should_fail/T5853.stderr b/testsuite/tests/typecheck/should_fail/T5853.stderr
index 1489583154..2d5c90284b 100644
--- a/testsuite/tests/typecheck/should_fail/T5853.stderr
+++ b/testsuite/tests/typecheck/should_fail/T5853.stderr
@@ -1,6 +1,6 @@
T5853.hs:15:52: error:
- Could not deduce: t2 ~ Subst t1 (Elem t2)
+ Could not deduce: Subst t1 (Elem t2) ~ t2
from the context: (F t,
Subst t (Elem t2) ~ t2,
Subst t2 (Elem t) ~ t,
diff --git a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
index 434d5e34a7..e41d8c1b10 100644
--- a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
+++ b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
@@ -1,12 +1,14 @@
TcCoercibleFail.hs:11:8: error:
Couldn't match representation of type ‘Int’ with that of ‘()’
+ arising from a use of ‘coerce’
In the expression: coerce
In the expression: coerce $ one :: ()
In an equation for ‘foo1’: foo1 = coerce $ one :: ()
TcCoercibleFail.hs:14:8: error:
Couldn't match representation of type ‘m Int’ with that of ‘m Age’
+ arising from a use of ‘coerce’
NB: We cannot know what roles the parameters to ‘m’ have;
we must assume that the role is nominal
Relevant bindings include
@@ -16,18 +18,14 @@ TcCoercibleFail.hs:14:8: error:
In an equation for ‘foo2’: foo2 = coerce $ (return one :: m Int)
TcCoercibleFail.hs:16:8: error:
- Couldn't match type ‘Int’ with ‘Age’
- arising from trying to show that the representations of
- ‘Map Int ()’ and
- ‘Map Age ()’ are the same
- Relevant role signatures: type role Map nominal representational
+ Couldn't match type ‘Int’ with ‘Age’ arising from a use of ‘coerce’
In the expression: coerce
In the expression: coerce $ Map one () :: Map Age ()
In an equation for ‘foo3’: foo3 = coerce $ Map one () :: Map Age ()
TcCoercibleFail.hs:18:8: error:
Couldn't match representation of type ‘Int’ with that of ‘Down Int’
- Relevant role signatures: type role Down representational
+ arising from a use of ‘coerce’
The data constructor ‘Down’ of newtype ‘Down’ is not in scope
In the expression: coerce
In the expression: coerce $ one :: Down Int
@@ -35,13 +33,14 @@ TcCoercibleFail.hs:18:8: error:
TcCoercibleFail.hs:21:8: error:
Couldn't match representation of type ‘Void’ with that of ‘()’
+ arising from a use of ‘coerce’
In the expression: coerce :: Void -> ()
In an equation for ‘foo5’: foo5 = coerce :: Void -> ()
TcCoercibleFail.hs:24:9: error:
Couldn't match representation of type ‘VoidBad ()’
with that of ‘()’
- Relevant role signatures: type role VoidBad phantom
+ arising from a use of ‘coerce’
In the expression: coerce :: (VoidBad ()) -> ()
In an equation for ‘foo5'’: foo5' = coerce :: (VoidBad ()) -> ()
@@ -60,11 +59,6 @@ TcCoercibleFail.hs:29:8: error:
Couldn't match representation of type ‘Either
Int (Fix (Either Int))’
with that of ‘()’
- arising from trying to show that the representations of
- ‘Fix (Either Int)’ and
- ‘()’ are the same
- Relevant role signatures:
- type role Either representational representational
- type role Fix nominal
+ arising from a use of ‘coerce’
In the expression: coerce :: Fix (Either Int) -> ()
In an equation for ‘foo7’: foo7 = coerce :: Fix (Either Int) -> ()
diff --git a/testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr b/testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr
index f4ebe40bb1..823b4c375d 100644
--- a/testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr
+++ b/testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr
@@ -1,12 +1,6 @@
-TcCoercibleFail3.hs:12:7:
+TcCoercibleFail3.hs:12:7: error:
Couldn't match representation of type ‘NT1’ with that of ‘NT2’
- arising from trying to show that the representations of
- ‘T NT1’ and
- ‘T NT2’ are the same
- Relevant role signatures:
- type role NT2 representational
- type role NT1 representational
- type role T representational
+ arising from a use of ‘coerce’
In the expression: coerce
In an equation for ‘foo’: foo = coerce
diff --git a/testsuite/tests/typecheck/should_fail/tcfail182.stderr b/testsuite/tests/typecheck/should_fail/tcfail182.stderr
index d223ca5e1a..fa628a4049 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail182.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail182.stderr
@@ -1,10 +1,9 @@
-tcfail182.hs:9:3:
+tcfail182.hs:9:3: error:
Couldn't match expected type ‘Prelude.Maybe a’
with actual type ‘Maybe t0’
- NB: ‘Prelude.Maybe’
- is defined in ‘GHC.Base’ in package ‘base-4.8.2.0’
- ‘Maybe’ is defined at tcfail182.hs:6:1-18
+ NB: ‘Maybe’ is defined at tcfail182.hs:6:1-18
+ ‘Prelude.Maybe’ is defined in ‘GHC.Base’ in package ‘base-4.8.2.0’
Relevant bindings include
f :: Prelude.Maybe a -> Int (bound at tcfail182.hs:9:1)
In the pattern: Foo