diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2015-06-08 15:57:33 -0400 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2015-06-16 14:22:51 -0400 |
commit | 0de0b14691e0b0789988332ad5addc2a31b09ba6 (patch) | |
tree | 19cd1fb41aa065a11b03d0e92a6355f83f9f5392 /compiler/typecheck/TcErrors.hs | |
parent | c772f57e128e04415949f91f299ec9bcc60c4caf (diff) | |
download | haskell-0de0b14691e0b0789988332ad5addc2a31b09ba6.tar.gz |
Fix #10495.
This change means that the intricate reasoning in TcErrors
around getting messages just right for nominal equalities
is skipped for representational equalities.
Diffstat (limited to 'compiler/typecheck/TcErrors.hs')
-rw-r--r-- | compiler/typecheck/TcErrors.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index a4c4703ec3..415ac26d43 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -919,6 +919,7 @@ mkTyVarEqErr dflags ctxt extra ct oriented tv1 ty2 -- be oriented the other way round; -- see TcCanonical.canEqTyVarTyVar || isSigTyVar tv1 && not (isTyVarTy ty2) + || ctEqRel ct == ReprEq -- the cases below don't really apply to ReprEq = mkErrorMsgFromCt ctxt ct (vcat [ misMatchOrCND ctxt ct oriented ty1 ty2 , extraTyVarInfo ctxt tv1 ty2 , extra ]) @@ -1042,13 +1043,19 @@ 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 (ctEqRel ct) ty1 ty2 + = misMatchMsg oriented eq_rel ty1 ty2 | otherwise - = couldNotDeduce givens ([mkTcEqPred ty1 ty2], orig) + = 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 - orig = TypeEqOrigin { uo_actual = ty1, uo_expected = ty2 } + + (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 ) couldNotDeduce :: [UserGiven] -> (ThetaType, CtOrigin) -> SDoc couldNotDeduce givens (wanteds, orig) |