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

git at git.haskell.org git at git.haskell.org
Thu Apr 7 14:50:25 UTC 2016


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

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

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

commit cdcd101428fc528b03c233ed60122ce4a93bf46f
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.


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

cdcd101428fc528b03c233ed60122ce4a93bf46f
 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