[commit: ghc] master: Build correct substitution in instDFunType (a49228e)
git at git.haskell.org
git at git.haskell.org
Tue Mar 29 11:31:42 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/a49228e3b6e3737da750bce59ec721b3b2f18eed/ghc
>---------------------------------------------------------------
commit a49228e3b6e3737da750bce59ec721b3b2f18eed
Author: Bartosz Nitka <niteria at gmail.com>
Date: Tue Mar 29 12:42:16 2016 +0200
Build correct substitution in instDFunType
We will use `ty` in the range of the substitution, hence
the substitution needs `ty`'s free vars in-scope.
They don't seem easily available by other means, so we
just compute them.
Test Plan: ./validate
Reviewers: austin, goldfire, bgamari, simonpj
Reviewed By: simonpj
Subscribers: thomie, simonmar
Differential Revision: https://phabricator.haskell.org/D2043
GHC Trac Issues: #11371
>---------------------------------------------------------------
a49228e3b6e3737da750bce59ec721b3b2f18eed
compiler/typecheck/Inst.hs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/compiler/typecheck/Inst.hs b/compiler/typecheck/Inst.hs
index ab9a4e2..49f57a5 100644
--- a/compiler/typecheck/Inst.hs
+++ b/compiler/typecheck/Inst.hs
@@ -306,14 +306,16 @@ instDFunType :: DFunId -> [DFunInstType]
-- See Note [DFunInstType: instantiating types] in InstEnv
instDFunType dfun_id dfun_inst_tys
= do { (subst, inst_tys) <- go emptyTCvSubst dfun_tvs dfun_inst_tys
- ; return (inst_tys, substThetaUnchecked subst dfun_theta) }
+ ; return (inst_tys, substTheta subst dfun_theta) }
where
(dfun_tvs, dfun_theta, _) = tcSplitSigmaTy (idType dfun_id)
go :: TCvSubst -> [TyVar] -> [DFunInstType] -> TcM (TCvSubst, [TcType])
go subst [] [] = return (subst, [])
go subst (tv:tvs) (Just ty : mb_tys)
- = do { (subst', tys) <- go (extendTvSubst subst tv ty) tvs mb_tys
+ = do { (subst', tys) <- go (extendTvSubstAndInScope subst tv ty)
+ tvs
+ mb_tys
; return (subst', ty : tys) }
go subst (tv:tvs) (Nothing : mb_tys)
= do { (subst', tv') <- newMetaTyVarX subst tv
More information about the ghc-commits
mailing list