summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Tc/Utils')
-rw-r--r--compiler/GHC/Tc/Utils/Unify.hs6
-rw-r--r--compiler/GHC/Tc/Utils/Zonk.hs18
2 files changed, 15 insertions, 9 deletions
diff --git a/compiler/GHC/Tc/Utils/Unify.hs b/compiler/GHC/Tc/Utils/Unify.hs
index 8ffbfb959b..cd40ba4a13 100644
--- a/compiler/GHC/Tc/Utils/Unify.hs
+++ b/compiler/GHC/Tc/Utils/Unify.hs
@@ -1118,7 +1118,7 @@ tcSkolemiseScoped ctxt expected_ty thing_inside
tcExtendNameTyVarEnv tv_prs $
thing_inside rho_ty
- ; return (wrap <.> mkWpLet ev_binds, res) }
+ ; return (wrap <.> mkWpEvLet ev_binds, res) }
tcSkolemise ctxt expected_ty thing_inside
| isRhoTy expected_ty -- Short cut for common case
@@ -1136,9 +1136,9 @@ tcSkolemise ctxt expected_ty thing_inside
<- checkConstraints (getSkolemInfo skol_info) skol_tvs given $
thing_inside rho_ty
- ; return (wrap <.> mkWpLet ev_binds, result) }
+ ; return (wrap <.> mkWpEvLet ev_binds, result) }
-- The ev_binds returned by checkConstraints is very
- -- often empty, in which case mkWpLet is a no-op
+ -- often empty, in which case mkWpEvLet is a no-op
-- | Variant of 'tcSkolemise' that takes an ExpType
tcSkolemiseET :: UserTypeCtxt -> ExpSigmaType
diff --git a/compiler/GHC/Tc/Utils/Zonk.hs b/compiler/GHC/Tc/Utils/Zonk.hs
index 2180a113da..8a208b1714 100644
--- a/compiler/GHC/Tc/Utils/Zonk.hs
+++ b/compiler/GHC/Tc/Utils/Zonk.hs
@@ -891,12 +891,12 @@ zonkExpr env (XExpr (WrapExpr (HsWrap co_fn expr)))
zonkExpr env (XExpr (ExpansionExpr (HsExpanded a b)))
= XExpr . ExpansionExpr . HsExpanded a <$> zonkExpr env b
-zonkExpr env (XExpr (ConLikeTc con tvs tys))
- = XExpr . ConLikeTc con tvs <$> mapM zonk_scale tys
+zonkExpr env (XExpr (ConLikeTc con arg_tys))
+ = XExpr . ConLikeTc con <$> mapM zonk_scale arg_tys
where
zonk_scale (Scaled m ty) = Scaled <$> zonkTcTypeToTypeX env m <*> pure ty
- -- Only the multiplicity can contain unification variables
- -- The tvs come straight from the data-con, and so are strictly redundant
+ -- Only the multiplicities can contain unification variables;
+ -- the types come straight from the data constructor.
-- See Wrinkles of Note [Typechecking data constructors] in GHC.Tc.Gen.Head
zonkExpr _ expr = pprPanic "zonkExpr" (ppr expr)
@@ -1037,8 +1037,14 @@ zonkCoFn env (WpTyLam tv) = assert (isImmutableTyVar tv) $
; return (env', WpTyLam tv') }
zonkCoFn env (WpTyApp ty) = do { ty' <- zonkTcTypeToTypeX env ty
; return (env, WpTyApp ty') }
-zonkCoFn env (WpLet bs) = do { (env1, bs') <- zonkTcEvBinds env bs
- ; return (env1, WpLet bs') }
+zonkCoFn env (WpEvLet bs) = do { (env1, bs') <- zonkTcEvBinds env bs
+ ; return (env1, WpEvLet bs') }
+zonkCoFn env (WpHsLet id rhs) = do { rhs' <- zonkExpr env rhs
+ -- NB: important to zonk RHS first, so that
+ -- the 'Id' has the most up-to-date type.
+ ; id' <- zonkId id
+ ; let env' = extendIdZonkEnv env id'
+ ; return (env', WpHsLet id' rhs') }
zonkCoFn env (WpMultCoercion co) = do { co' <- zonkCoToCo env co
; return (env, WpMultCoercion co') }