Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/d6918e9072e421178d59cd13ee352337a4090c39 >--------------------------------------------------------------- commit d6918e9072e421178d59cd13ee352337a4090c39 Author: Simon Peyton Jones <[email protected]> Date: Thu Aug 23 11:04:22 2012 +0100 Don't assume that coercion variables have (~) types The constraint solver doesn't zonk the types of coercion variables so we can't assume that a coercion variable will have a (~) type. Fixes Trac #7090. >--------------------------------------------------------------- compiler/typecheck/TcEvidence.lhs | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/compiler/typecheck/TcEvidence.lhs b/compiler/typecheck/TcEvidence.lhs index 6d1e6fb..6ac351e 100644 --- a/compiler/typecheck/TcEvidence.lhs +++ b/compiler/typecheck/TcEvidence.lhs @@ -36,7 +36,7 @@ import Var import PprCore () -- Instance OutputableBndr TyVar import TypeRep -- Knows type representation import TcType -import Type( tyConAppArgN, getEqPredTys_maybe, tyConAppTyCon_maybe, getEqPredTys ) +import Type( tyConAppArgN, tyConAppTyCon_maybe, getEqPredTys ) import TysPrim( funTyCon ) import TyCon import PrelNames @@ -114,7 +114,7 @@ isEqVar v = case tyConAppTyCon_maybe (varType v) of isTcReflCo_maybe :: TcCoercion -> Maybe TcType isTcReflCo_maybe (TcRefl ty) = Just ty -isTcReflCo_maybe _ = Nothing +isTcReflCo_maybe _ = Nothing isTcReflCo :: TcCoercion -> Bool isTcReflCo (TcRefl {}) = True @@ -185,13 +185,12 @@ mkTcInstCos co tys = foldl TcInstCo co tys mkTcCoVarCo :: EqVar -> TcCoercion -- ipv :: s ~ t (the boxed equality type) -mkTcCoVarCo ipv - | ty1 `eqType` ty2 = TcRefl ty1 - | otherwise = TcCoVarCo ipv - where - (ty1, ty2) = case getEqPredTys_maybe (varType ipv) of - Nothing -> pprPanic "mkCoVarLCo" (ppr ipv $$ ppr (varType ipv)) - Just tys -> tys +mkTcCoVarCo ipv = TcCoVarCo ipv + -- Previously I checked for (ty ~ ty) and generated Refl, + -- but in fact ipv may not even (visibly) have a (t1 ~ t2) type, because + -- the constraint solver does not substitute in the types of + -- evidence variables as it goes. In any case, the optimisation + -- will be done in the later zonking phase \end{code} \begin{code} _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
