- ; ((tc_bind, _), lie) <- getLIE $
- tcExtendIdEnv [local_meth_id] $
- tcPolyBinds TopLevel meth_sig_fn no_prag_fn
- NonRecursive NonRecursive
- (unitBag bind)
-
- ; let avails = this_dict ++ dfun_dicts
- -- Only need the this_dict stuff if there are type
- -- variables involved; otherwise overlap is not possible
- -- See Note [Subtle interaction of recursion and overlap]
- -- in TcInstDcls
- ; lie_binds <- tcSimplifyCheck inst_loc tyvars avails lie
-
- ; let full_bind = AbsBinds tyvars dfun_lam_vars
- [(tyvars, meth_id, local_meth_id, spec_prags)]
- (this_bind `unionBags` lie_binds
- `unionBags` tc_bind)
-
- dfun_lam_vars = map instToVar dfun_dicts -- Includes equalities
+ let lm_bind = L loc (bind { fun_id = L loc (idName local_meth_id) })
+ -- Substitute the local_meth_name for the binder
+ -- NB: the binding is always a FunBind
+
+ ; (ev_binds, (tc_bind, _))
+ <- checkConstraints skol_info tyvars dfun_ev_vars $
+ tcExtendIdEnv [local_meth_id] $
+ tcPolyBinds TopLevel meth_sig_fn no_prag_fn
+ NonRecursive NonRecursive
+ [lm_bind]
+
+ ; let full_bind = AbsBinds { abs_tvs = tyvars, abs_ev_vars = dfun_ev_vars
+ , abs_exports = [(tyvars, meth_id, local_meth_id, specs)]
+ , abs_ev_binds = ev_binds
+ , abs_binds = tc_bind }