Commit d0ecba6d authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Fix a trailing case in making FamInstTyCon,

where the invariant didn't hold, leading to
subsequent chaos. Happily an ASSERT caught it.
parent 3d81b68d
......@@ -464,12 +464,19 @@ tc_iface_decl parent _ (IfaceData {ifName = occ_name,
branch = coAxiomSingleBranch ax_unbr
ax_tvs = coAxBranchTyVars branch
ax_lhs = coAxBranchLHS branch
subst = zipTopTvSubst ax_tvs (mkTyVarTys tyvars)
tycon_tys = mkTyVarTys tyvars
subst = mkTopTvSubst (ax_tvs `zip` tycon_tys)
-- The subst matches the tyvar of the TyCon
-- with those from the CoAxiom. They aren't
-- necessarily the same, since the two may be
-- gotten from separate interface-file declarations
; return (FamInstTyCon ax_unbr fam_tc (substTys subst ax_lhs)) }
-- NB: ax_tvs may be shorter because of eta-reduction
-- See Note [Eta reduction for data family axioms] in TcInstDcls
lhs_tys = substTys subst ax_lhs `chkAppend`
dropList ax_tvs tycon_tys
-- The 'lhs_tys' should be 1-1 with the 'tyvars'
-- but ax_tvs maybe shorter because of eta-reduction
; return (FamInstTyCon ax_unbr fam_tc lhs_tys) }
tc_iface_decl parent _ (IfaceSyn {ifName = occ_name, ifTyVars = tv_bndrs,
ifSynRhs = mb_rhs_ty,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment