Commit 6ebab3df authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Never unify a SigTyVar with a non-tyvar type (fixes Trac #7786)

This unwanted unification was happening in the zonking phase
which un-flattens type-function applications (TcMType.zonkFlats,
try_zonk_fun_eq).  The main unifier is careful to make the check,
but I'd forgotten it here.  That in turn led to a very confusing
error message.
parent 28c14617
......@@ -702,9 +702,9 @@ zonkFlats binds_var untch cts
, Just tv <- getTyVar_maybe ty_rhs
, ASSERT2( not (isFloatedTouchableMetaTyVar untch tv), ppr tv )
isTouchableMetaTyVar untch tv
, typeKind ty_lhs `tcIsSubKind` tyVarKind tv
, not (isSigTyVar tv) || isTyVarTy ty_lhs -- Never unify a SigTyVar with a non-tyvar
, typeKind ty_lhs `tcIsSubKind` tyVarKind tv -- c.f. TcInteract.trySpontaneousEqOneWay
, not (tv `elemVarSet` tyVarsOfType ty_lhs)
-- , Just ty_lhs' <- occurCheck tv ty_lhs
= ASSERT2( isWantedCt orig_ct, ppr orig_ct )
ASSERT2( case tcSplitTyConApp_maybe ty_lhs of { Just (tc,_) -> isSynFamilyTyCon tc; _ -> False }, ppr orig_ct )
do { writeMetaTyVar tv ty_lhs
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment