[commit: ghc] ghc-8.0: Fix some substitution InScopeSets (35d9486)

git at git.haskell.org git at git.haskell.org
Tue Feb 2 22:56:11 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/35d94865a20e430fe57cb2eb6d859cd182ac6f58/ghc

>---------------------------------------------------------------

commit 35d94865a20e430fe57cb2eb6d859cd182ac6f58
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Mon Jan 25 22:00:47 2016 -0500

    Fix some substitution InScopeSets
    
    This is relevant to #11371.
    
    (cherry picked from commit 2899aa580d633103fc551e36c977720b94f5b41c)


>---------------------------------------------------------------

35d94865a20e430fe57cb2eb6d859cd182ac6f58
 compiler/typecheck/TcHsType.hs | 2 +-
 compiler/typecheck/TcMType.hs  | 2 +-
 compiler/typecheck/TcType.hs   | 1 +
 compiler/types/TyCoRep.hs      | 4 ++++
 compiler/types/Type.hs         | 4 ++--
 5 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs
index 0a87bf4..e438df5 100644
--- a/compiler/typecheck/TcHsType.hs
+++ b/compiler/typecheck/TcHsType.hs
@@ -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') }
 
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index e5bfca1..3d9e57c 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -777,7 +777,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)
         }
diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs
index dbe6ba5..aa0ba52 100644
--- a/compiler/typecheck/TcType.hs
+++ b/compiler/typecheck/TcType.hs
@@ -149,6 +149,7 @@ module TcType (
   zipTvSubst,
   mkTvSubstPrs, 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,
diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index cd84ba2..5d039c4 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -1828,7 +1828,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 $$
diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs
index bcf7ef0..d952abb 100644
--- a/compiler/types/Type.hs
+++ b/compiler/types/Type.hs
@@ -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,
 



More information about the ghc-commits mailing list