diff options
-rw-r--r-- | compiler/typecheck/Inst.hs | 9 | ||||
-rw-r--r-- | compiler/typecheck/TcCanonical.hs | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/compiler/typecheck/Inst.hs b/compiler/typecheck/Inst.hs index daadf57313..28794aaafa 100644 --- a/compiler/typecheck/Inst.hs +++ b/compiler/typecheck/Inst.hs @@ -297,24 +297,23 @@ instTyVarsWith :: CtOrigin -> [TyVar] -> [TcType] -> TcM TCvSubst -- If they don't match, emit a kind-equality to promise that they will -- eventually do so, and thus make a kind-homongeneous substitution. instTyVarsWith orig tvs tys - = go empty_subst tvs tys + = go emptyTCvSubst tvs tys where - empty_subst = mkEmptyTCvSubst (mkInScopeSet (tyCoVarsOfTypes tys)) - go subst [] [] = return subst go subst (tv:tvs) (ty:tys) | tv_kind `tcEqType` ty_kind - = go (extendTCvSubst subst tv ty) tvs tys + = go (extendTvSubstAndInScope subst tv ty) tvs tys | otherwise = do { co <- emitWantedEq orig KindLevel Nominal ty_kind tv_kind - ; go (extendTCvSubst subst tv (ty `mkCastTy` co)) tvs tys } + ; go (extendTvSubstAndInScope subst tv (ty `mkCastTy` co)) tvs tys } where tv_kind = substTy subst (tyVarKind tv) ty_kind = tcTypeKind ty go _ _ _ = pprPanic "instTysWith" (ppr tvs $$ ppr tys) + {- ************************************************************************ * * diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs index e0c87e0f70..c296a9eee3 100644 --- a/compiler/typecheck/TcCanonical.hs +++ b/compiler/typecheck/TcCanonical.hs @@ -1007,7 +1007,7 @@ can_eq_nc_forall ev eq_rel s1 s2 = do { let tv2 = binderVar bndr2 ; (kind_co, wanteds1) <- unify loc Nominal (tyVarKind skol_tv) (substTy subst (tyVarKind tv2)) - ; let subst' = extendTvSubst subst tv2 + ; let subst' = extendTvSubstAndInScope subst tv2 (mkCastTy (mkTyVarTy skol_tv) kind_co) ; (co, wanteds2) <- go skol_tvs subst' bndrs2 ; return ( mkTcForAllCo skol_tv kind_co co |