diff options
author | Bartosz Nitka <niteria@gmail.com> | 2016-03-29 12:42:32 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-03-29 12:42:33 +0200 |
commit | 4a93e4f9a86a62d1cdf2e666f977b8b58e61eaaf (patch) | |
tree | 196d0854b6f6feb0eeba73ca5ca56a461ac55b4a /compiler/coreSyn | |
parent | a49228e3b6e3737da750bce59ec721b3b2f18eed (diff) | |
download | haskell-4a93e4f9a86a62d1cdf2e666f977b8b58e61eaaf.tar.gz |
Use the correct substitution in lintCoercion
We need the free vars of `t2` to satisfy the substitution
invariant. Luckily they are in the in-scope carried around.
Test Plan: ./validate
Reviewers: bgamari, austin, goldfire, simonpj
Reviewed By: simonpj
Subscribers: thomie, simonmar
Differential Revision: https://phabricator.haskell.org/D2044
GHC Trac Issues: #11371
Diffstat (limited to 'compiler/coreSyn')
-rw-r--r-- | compiler/coreSyn/CoreLint.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index ef44affd3e..bd750a346b 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1291,9 +1291,14 @@ lintCoercion (ForAllCo tv1 kind_co co) = do { (_, k2) <- lintStarCoercion kind_co ; let tv2 = setTyVarKind tv1 k2 ; (k3, k4, t1, t2, r) <- addInScopeVar tv1 $ lintCoercion co + ; in_scope <- getInScope ; let tyl = mkNamedForAllTy tv1 Invisible t1 + subst = zipTvSubst [tv1] [TyVarTy tv2 `mkCastTy` mkSymCo kind_co] + `extendTCvInScopeInScope` in_scope + -- We need free vars of `t2` in scope to satisfy + -- Note [The substitution invariant] tyr = mkNamedForAllTy tv2 Invisible $ - substTyWithUnchecked [tv1] [TyVarTy tv2 `mkCastTy` mkSymCo kind_co] t2 + substTy subst t2 ; return (k3, k4, tyl, tyr, r) } lintCoercion (CoVarCo cv) |