import Type ( Type, ThetaType, mkDictTy, mkDictTys, mkTyConApp, mkTyVarTys,
mkFunTys, mkFunTy, mkSigmaTy,
isUnLiftedType, mkForAllTys, mkTyVarTy, tyVarsOfType,
- splitFunTys, splitForAllTys, unUsgTy,
- mkUsgTy, UsageAnn(..)
+ splitFunTys, splitForAllTys
)
import Module ( Module )
import CoreUtils ( exprType, mkInlineMe )
)
import IdInfo ( IdInfo, vanillaIdInfo, mkIdInfo,
exactArity, setUnfoldingInfo, setCafInfo, setCprInfo,
- setArityInfo, setSpecInfo,
+ setArityInfo, setSpecInfo, setTyGenInfo,
mkStrictnessInfo, setStrictnessInfo,
- IdFlavour(..), CafInfo(..), CprInfo(..)
+ IdFlavour(..), CafInfo(..), CprInfo(..), TyGenInfo(..)
)
import FieldLabel ( mkFieldLabel, fieldLabelName,
firstFieldLabelTag, allFieldLabelTags, fieldLabelType
-- Maybe a SysLocal? But then we'd lose the location
mkDefaultMethodId dm_name rec_c ty
- = mkVanillaId dm_name ty
+ = mkId dm_name ty info
+ where
+ info = vanillaIdInfo `setTyGenInfo` TyGenNever
+ -- type is wired-in (see comment at TcClassDcl.tcClassSig), so
+ -- do not generalise it
mkWorkerId uniq unwrkr ty
= mkVanillaId (mkDerivedName mkWorkerOcc (getName unwrkr) uniq) ty
-- The wrapper Id ends up in STG code as an argument,
-- sometimes before its definition, so we want to
-- signal that it has no CAFs
+ `setTyGenInfo` TyGenNever
+ -- No point generalising its type, since it gets eagerly inlined
+ -- away anyway
wrap_ty = mkForAllTys all_tyvars $
mkFunTys all_arg_tys
`setArityInfo` exactArity (1 + length dict_tys)
`setUnfoldingInfo` unfolding
`setCafInfo` NoCafRefs
+ `setTyGenInfo` TyGenNever
-- ToDo: consider adding further IdInfo
unfolding = mkTopUnfolding sel_rhs
mkLams dict_ids $ Lam data_id $
sel_body
- sel_body | isNewTyCon tycon = Note (Coerce (unUsgTy field_tau) (unUsgTy data_ty)) (Var data_id)
+ sel_body | isNewTyCon tycon = Note (Coerce field_tau data_ty) (Var data_id)
| otherwise = Case (Var data_id) data_id (the_alts ++ default_alt)
mk_maybe_alt data_con
maybe_the_arg_id = assocMaybe (field_lbls `zip` arg_ids) field_label
field_lbls = dataConFieldLabels data_con
- error_expr = mkApps (Var rEC_SEL_ERROR_ID) [Type (unUsgTy field_tau), err_string]
- -- preserves invariant that type args are *not* usage-annotated on top. KSW 1999-04.
+ error_expr = mkApps (Var rEC_SEL_ERROR_ID) [Type field_tau, err_string]
err_string
| all safeChar full_msg
= App (Var unpack_id) (Lit (MachStr (_PK_ full_msg)))
`setArityInfo` exactArity 1
`setUnfoldingInfo` unfolding
`setCafInfo` NoCafRefs
+ `setTyGenInfo` TyGenNever
-- We no longer use 'must-inline' on record selectors. They'll
-- inline like crazy if they scrutinise a constructor
-> Id
mkDictFunId dfun_name clas inst_tyvars inst_tys dfun_theta
- = mkVanillaId dfun_name dfun_ty
+ = mkId dfun_name dfun_ty info
where
dfun_ty = mkSigmaTy inst_tyvars dfun_theta (mkDictTy clas inst_tys)
+ info = vanillaIdInfo `setTyGenInfo` TyGenNever
+ -- type is wired-in (see comment at TcClassDcl.tcClassSig), so
+ -- do not generalise it
{- 1 dec 99: disable the Mark Jones optimisation for the sake
of compatibility with Hugs.
openBetaTy = mkTyVarTy openBetaTyVar
errorTy :: Type
-errorTy = mkUsgTy UsMany $
- mkSigmaTy [openAlphaTyVar] [] (mkFunTys [mkUsgTy UsOnce (mkListTy charTy)]
- (mkUsgTy UsMany openAlphaTy))
+errorTy = mkSigmaTy [openAlphaTyVar] [] (mkFunTys [mkListTy charTy]
+ openAlphaTy)
-- Notice the openAlphaTyVar. It says that "error" can be applied
-- to unboxed as well as boxed types. This is OK because it never
-- returns, so the return type is irrelevant.