[commit: ghc] master: Apply the interim fix for #14119 to liftCoMatch (ef44382)

git at git.haskell.org git at git.haskell.org
Mon Apr 2 02:44:20 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ef443820b71f5c9c2dca362217f1a9fbab6dd736/ghc

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

commit ef443820b71f5c9c2dca362217f1a9fbab6dd736
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date:   Sat Feb 24 11:49:15 2018 -0500

    Apply the interim fix for #14119 to liftCoMatch
    
    Matching in the presence of casts can happen in liftCoMatch, too.


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

ef443820b71f5c9c2dca362217f1a9fbab6dd736
 compiler/types/Unify.hs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs
index 34f2fac..cb651ee 100644
--- a/compiler/types/Unify.hs
+++ b/compiler/types/Unify.hs
@@ -1328,7 +1328,13 @@ ty_co_match menv subst ty co lkco rkco
 
 ty_co_match menv subst ty co lkco rkco
   | CastTy ty' co' <- ty
-  = ty_co_match menv subst ty' co (co' `mkTransCo` lkco) (co' `mkTransCo` rkco)
+     -- See Note [Matching in the presence of casts]
+  = let empty_subst  = mkEmptyTCvSubst (rnInScopeSet (me_env menv))
+        substed_co_l = substCo (liftEnvSubstLeft empty_subst subst)  co'
+        substed_co_r = substCo (liftEnvSubstRight empty_subst subst) co'
+    in
+    ty_co_match menv subst ty' co (substed_co_l `mkTransCo` lkco)
+                                  (substed_co_r `mkTransCo` rkco)
 
   | CoherenceCo co1 co2 <- co
   = ty_co_match menv subst ty co1 (lkco `mkTransCo` mkSymCo co2) rkco



More information about the ghc-commits mailing list