summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@cs.brynmawr.edu>2018-02-24 11:49:15 -0500
committerRichard Eisenberg <rae@cs.brynmawr.edu>2018-03-31 23:17:01 -0400
commitef443820b71f5c9c2dca362217f1a9fbab6dd736 (patch)
treeab5e11768301418498d2a1602d2798eb89668991
parentfaec8d358985e5d0bf363bd96f23fe76c9e281f7 (diff)
downloadhaskell-ef443820b71f5c9c2dca362217f1a9fbab6dd736.tar.gz
Apply the interim fix for #14119 to liftCoMatch
Matching in the presence of casts can happen in liftCoMatch, too.
-rw-r--r--compiler/types/Unify.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs
index 34f2fac56b..cb651ee3c3 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