[commit: ghc] ghc-8.0: Fix the in-scope set for extendTvSubstWithClone (cc3a950)

git at git.haskell.org git at git.haskell.org
Mon Nov 7 19:42:08 UTC 2016


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

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

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

commit cc3a9504f638fe14fd6532c3b616343a2ee947dd
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Sun Jun 12 00:04:30 2016 +0100

    Fix the in-scope set for extendTvSubstWithClone
    
    We'd forgotten the variables free in the kind.
    
    Ditto extendCvSubstWithClone
    
    (cherry picked from commit 15fc52819c440f9e9b91ce92fcfda3c264cbe1c1)


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

cc3a9504f638fe14fd6532c3b616343a2ee947dd
 compiler/types/TyCoRep.hs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index fc2ac90..527270b 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -1718,9 +1718,11 @@ extendTvSubst (TCvSubst in_scope tenv cenv) tv ty
 extendTvSubstWithClone :: TCvSubst -> TyVar -> TyVar -> TCvSubst
 -- Adds a new tv -> tv mapping, /and/ extends the in-scope set
 extendTvSubstWithClone (TCvSubst in_scope tenv cenv) tv tv'
-  = TCvSubst (extendInScopeSet in_scope tv')
+  = TCvSubst (extendInScopeSetSet in_scope new_in_scope)
              (extendVarEnv tenv tv (mkTyVarTy tv'))
              cenv
+  where
+    new_in_scope = tyCoVarsOfType (tyVarKind tv') `extendVarSet` tv'
 
 extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst
 extendCvSubst (TCvSubst in_scope tenv cenv) v co
@@ -1728,9 +1730,11 @@ extendCvSubst (TCvSubst in_scope tenv cenv) v co
 
 extendCvSubstWithClone :: TCvSubst -> CoVar -> CoVar -> TCvSubst
 extendCvSubstWithClone (TCvSubst in_scope tenv cenv) cv cv'
-  = TCvSubst (extendInScopeSet in_scope cv')
+  = TCvSubst (extendInScopeSetSet in_scope new_in_scope)
              tenv
              (extendVarEnv cenv cv (mkCoVarCo cv'))
+  where
+    new_in_scope = tyCoVarsOfType (varType cv') `extendVarSet` cv'
 
 extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst
 -- Also extends the in-scope set



More information about the ghc-commits mailing list