Fix some substitution InScopeSets
authorRichard Eisenberg <eir@cis.upenn.edu>
Tue, 26 Jan 2016 03:00:47 +0000 (22:00 -0500)
committerRichard Eisenberg <eir@cis.upenn.edu>
Wed, 27 Jan 2016 14:28:29 +0000 (09:28 -0500)
This is relevant to #11371.

compiler/typecheck/TcHsType.hs
compiler/typecheck/TcMType.hs
compiler/typecheck/TcType.hs
compiler/types/TyCoRep.hs
compiler/types/Type.hs

index 1b6d5cf..c752dba 100644 (file)
@@ -847,7 +847,7 @@ tcInstBinderX :: Maybe (VarEnv Kind)
 tcInstBinderX mb_kind_info subst binder
   | Just tv <- binderVar_maybe binder
   = case lookup_tv tv of
-      Just ki -> return (extendTCvSubst subst tv ki, ki)
+      Just ki -> return (extendTCvSubstAndInScope subst tv ki, ki)
       Nothing -> do { (subst', tv') <- newMetaTyVarX subst tv
                     ; return (subst', mkTyVarTy tv') }
 
index a160d4e..b7fe68c 100644 (file)
@@ -693,7 +693,7 @@ newMetaTyVarX subst tyvar
                        -- See Note [Name of an instantiated type variable]
               kind   = substTyUnchecked subst (tyVarKind tyvar)
               new_tv = mkTcTyVar name kind details
-        ; return (extendTCvSubst (extendTCvInScope subst new_tv) tyvar
+        ; return (extendTCvSubstAndInScope subst tyvar
                    (mkTyVarTy new_tv)
                  , new_tv)
         }
index a3e449d..796c042 100644 (file)
@@ -145,6 +145,7 @@ module TcType (
   mkOpenTCvSubst, zipOpenTCvSubst,
   mkTopTCvSubst, notElemTCvSubst, unionTCvSubst,
   getTvSubstEnv, setTvSubstEnv, getTCvInScope, extendTCvInScope,
+  extendTCvInScopeList, extendTCvInScopeSet, extendTCvSubstAndInScope,
   Type.lookupTyVar, Type.extendTCvSubst, Type.substTyVarBndr,
   extendTCvSubstList, isInScope, mkTCvSubst, zipTyEnv, zipCoEnv,
   Type.substTy, substTys, substTyWith, substTyWithCoVars,
index 08d3b79..dcffbe0 100644 (file)
@@ -1864,7 +1864,11 @@ substTy subst@(TCvSubst in_scope tenv cenv) ty
   | otherwise = ASSERT2( isValidTCvSubst subst,
                          text "in_scope" <+> ppr in_scope $$
                          text "tenv" <+> ppr tenv $$
+                         text "tenvFVs"
+                           <+> ppr (tyCoVarsOfTypes $ varEnvElts tenv) $$
                          text "cenv" <+> ppr cenv $$
+                         text "cenvFVs"
+                           <+> ppr (tyCoVarsOfCos $ varEnvElts cenv) $$
                          text "ty" <+> ppr ty )
                 ASSERT2( typeFVsInScope,
                          text "in_scope" <+> ppr in_scope $$
index 81e5773..3992a71 100644 (file)
@@ -154,8 +154,8 @@ module Type (
         notElemTCvSubst,
         getTvSubstEnv, setTvSubstEnv,
         zapTCvSubst, getTCvInScope,
-        extendTCvInScope, extendTCvInScopeList,
-        extendTCvSubst, extendTCvSubstList,
+        extendTCvInScope, extendTCvInScopeList, extendTCvInScopeSet,
+        extendTCvSubst, extendTCvSubstList, extendTCvSubstAndInScope,
         isInScope, composeTCvSubstEnv, composeTCvSubst, zipTyEnv, zipCoEnv,
         isEmptyTCvSubst, unionTCvSubst,