[Type-constraints] Fix type variable substitution
This commit is contained in:
parent
39659b2917
commit
fde7bafe56
@ -70,11 +70,12 @@ collectSpansTypes tcs lc =
|
|||||||
build x | Just cti <- x `M.lookup` s
|
build x | Just cti <- x `M.lookup` s
|
||||||
= let
|
= let
|
||||||
(preds', ctt) = getPreds cti
|
(preds', ctt) = getPreds cti
|
||||||
vt = G.varType x
|
vts = listifyStaged TypeChecker G.isTyVar $ G.varType x
|
||||||
in (preds',) . (, vt) <$> G.getTyVar_maybe ctt
|
tvm = listifyStaged TypeChecker G.isTyVarTy ctt
|
||||||
|
in Just (preds', zip vts tvm)
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
preds = concatMap fst ctys
|
preds = concatMap fst ctys
|
||||||
subs = G.mkTopTvSubst $ map snd ctys
|
subs = G.mkTopTvSubst $ concatMap snd ctys
|
||||||
ty = G.substTy subs $ G.mkFunTys preds genTyp
|
ty = G.substTy subs $ G.mkFunTys preds genTyp
|
||||||
in [(spn, G.tidyTopType ty)]
|
in [(spn, G.tidyTopType ty)]
|
||||||
getPreds x | G.isForAllTy x = getPreds $ G.dropForAlls x
|
getPreds x | G.isForAllTy x = getPreds $ G.dropForAlls x
|
||||||
|
Loading…
Reference in New Issue
Block a user