[commit: ghc] wip/rae: Increase InScopeSet in mkCastTy (8719a1f)

git at git.haskell.org git at git.haskell.org
Wed Apr 6 14:37:29 UTC 2016


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

On branch  : wip/rae
Link       : http://ghc.haskell.org/trac/ghc/changeset/8719a1fe015c241890f3f3ba1431805f1f4193d7/ghc

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

commit 8719a1fe015c241890f3f3ba1431805f1f4193d7
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Wed Apr 6 15:24:34 2016 +0200

    Increase InScopeSet in mkCastTy
    
    Unfortunately, I was unable to make a small test case that
    tickled the bug. But it was clearly wrong the way it was.


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

8719a1fe015c241890f3f3ba1431805f1f4193d7
 compiler/types/Type.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs
index c5561a3..8901968 100644
--- a/compiler/types/Type.hs
+++ b/compiler/types/Type.hs
@@ -1084,9 +1084,9 @@ mkCastTy ty co | isReflexiveCo co = ty
 
 mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2)
 -- See Note [Weird typing rule for ForAllTy]
-mkCastTy (ForAllTy (Named tv vis) inner_ty) co
+mkCastTy outer_ty@(ForAllTy (Named tv vis) inner_ty) co
   = -- have to make sure that pushing the co in doesn't capture the bound var
-    let fvs = tyCoVarsOfCo co
+    let fvs = tyCoVarsOfCo co `unionVarSet` tyCoVarsOfType outer_ty
         empty_subst = mkEmptyTCvSubst (mkInScopeSet fvs)
         (subst, tv') = substTyVarBndr empty_subst tv
     in



More information about the ghc-commits mailing list