Skip to content

Commit

Permalink
An accidentally-omitted part of commit 8019bc2, about promoting data …
Browse files Browse the repository at this point in the history
…constructors
  • Loading branch information
Simon Peyton Jones authored and Ian Lynagh committed Nov 29, 2012
1 parent 4b380f1 commit 29bbb9f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions compiler/typecheck/TcHsType.lhs
Expand Up @@ -427,8 +427,8 @@ tc_hs_type hs_ty@(HsExplicitListTy _k tys) exp_kind
; checkExpectedKind hs_ty (mkPromotedListTy kind) exp_kind
; return (foldr (mk_cons kind) (mk_nil kind) taus) }
where
mk_cons k a b = mkTyConApp (buildPromotedDataCon consDataCon) [k, a, b]
mk_nil k = mkTyConApp (buildPromotedDataCon nilDataCon) [k]
mk_cons k a b = mkTyConApp (promoteDataCon consDataCon) [k, a, b]
mk_nil k = mkTyConApp (promoteDataCon nilDataCon) [k]
tc_hs_type hs_ty@(HsExplicitTupleTy _ tys) exp_kind
= do { tks <- mapM tc_infer_lhs_type tys
Expand Down Expand Up @@ -603,12 +603,10 @@ tcTyVar name -- Could be a tyvar, a tycon, or a datacon
AGlobal (ATyCon tc) -> inst_tycon (mkTyConApp tc) (tyConKind tc)
AGlobal (ADataCon dc)
| isPromotableType ty -> inst_tycon (mkTyConApp tc) (tyConKind tc)
| Just tc <- promoteDataCon_maybe dc
-> inst_tycon (mkTyConApp tc) (tyConKind tc)
| otherwise -> failWithTc (quotes (ppr dc) <+> ptext (sLit "of type")
<+> quotes (ppr ty) <+> ptext (sLit "is not promotable"))
where
ty = dataConUserType dc
tc = buildPromotedDataCon dc
<+> quotes (ppr (dataConUserType dc)) <+> ptext (sLit "is not promotable"))
APromotionErr err -> promotionErr name err
Expand Down Expand Up @@ -1429,7 +1427,7 @@ tc_kind_var_app name arg_kis
; unless data_kinds $ addErr (dataKindsErr name)
; case isPromotableTyCon tc of
Just n | n == length arg_kis ->
return (mkTyConApp (buildPromotedTyCon tc) arg_kis)
return (mkTyConApp (promoteTyCon tc) arg_kis)
Just _ -> tycon_err tc "is not fully applied"
Nothing -> tycon_err tc "is not promotable" }
Expand Down

0 comments on commit 29bbb9f

Please sign in to comment.