import Id ( Id, mkVanillaGlobal, mkLocalId, idName, isDataConWrapId_maybe )
import Module ( Module )
-import MkId ( mkCCallOpId )
+import MkId ( mkFCallId )
import IdInfo
+import TyCon ( tyConDataCons )
import DataCon ( DataCon, dataConId, dataConSig, dataConArgTys )
-import Type ( mkTyVarTys, splitAlgTyConApp_maybe )
+import Type ( mkTyVarTys, splitTyConApp )
import TysWiredIn ( tupleCon )
import Var ( mkTyVar, tyVarKind )
import Name ( Name, nameIsLocalOrFrom )
-import Demand ( wwLazy )
import ErrUtils ( pprBagOfErrors )
import Outputable
import Util ( zipWithEqual )
init_info = vanillaIdInfo `setCgInfo` vanillaCgInfo
tcPrag info (HsNoCafRefs) = returnTc (info `setCafInfo` NoCafRefs)
- tcPrag info HsCprInfo = returnTc (info `setCprInfo` ReturnsCPR)
tcPrag info (HsArity arity) =
- returnTc (info `setArityInfo` (ArityExactly arity)
+ returnTc (info `setArityInfo` arity
`setCgArity` arity)
tcPrag info (HsUnfold inline_prag expr)
returnTc info2
tcPrag info (HsStrictness strict_info)
- = returnTc (info `setStrictnessInfo` strict_info)
+ = returnTc (info `setNewStrictnessInfo` Just strict_info)
tcPrag info (HsWorker nm arity)
= tcWorkerInfo unf_env ty info nm arity
\begin{code}
tcWorkerInfo unf_env ty info worker_name arity
- = uniqSMToTcM (mkWrapper ty arity demands res_bot cpr_info) `thenNF_Tc` \ wrap_fn ->
+ = uniqSMToTcM (mkWrapper ty strict_sig) `thenNF_Tc` \ wrap_fn ->
let
-- Watch out! We can't pull on unf_env too eagerly!
info' = case tcLookupRecId_maybe unf_env worker_name of
in
returnTc info'
where
- -- We are relying here on cpr and strictness info always appearing
+ -- We are relying here on strictness info always appearing
-- before worker info, fingers crossed ....
- cpr_info = cprInfo info
-
- (demands, res_bot)
- = case strictnessInfo info of
- StrictnessInfo d r -> (d,r)
- _ -> (take arity (repeat wwLazy),False)
- -- Noncommittal
+ strict_sig = case newStrictnessInfo info of
+ Just sig -> sig
+ Nothing -> pprPanic "Worker info but no strictness for" (ppr worker_name)
\end{code}
For unfoldings we try to do the job lazily, so that we never type check
= tcIfaceType ty `thenTc` \ ty' ->
returnTc (Lit (MachLitLit lit ty'))
-tcCoreExpr (UfCCall cc ty)
+tcCoreExpr (UfFCall cc ty)
= tcIfaceType ty `thenTc` \ ty' ->
tcGetUnique `thenNF_Tc` \ u ->
- returnTc (Var (mkCCallOpId u cc ty'))
+ returnTc (Var (mkFCallId u cc ty'))
tcCoreExpr (UfTuple (HsTupCon _ boxity arity) args)
= mapTc tcCoreExpr args `thenTc` \ args' ->
let
(main_tyvars, _, ex_tyvars, _, _, _) = dataConSig con
- (_, inst_tys, cons) = case splitAlgTyConApp_maybe scrut_ty of
- Just stuff -> stuff
- Nothing -> pprPanic "tcCoreAlt" (ppr alt)
+ (tycon, inst_tys) = splitTyConApp scrut_ty -- NB: not tcSplitTyConApp
+ -- We are looking at Core here
ex_tyvars' = [mkTyVar name (tyVarKind tv) | (name,tv) <- names `zip` ex_tyvars]
ex_tys' = mkTyVarTys ex_tyvars'
arg_tys = dataConArgTys con (inst_tys ++ ex_tys')
#endif
= zipWithEqual "tcCoreAlts" mkLocalId id_names arg_tys
in
- ASSERT( con `elem` cons && length inst_tys == length main_tyvars )
+ ASSERT( con `elem` tyConDataCons tycon && length inst_tys == length main_tyvars )
tcExtendTyVarEnv ex_tyvars' $
tcExtendGlobalValEnv arg_ids $
tcCoreExpr rhs `thenTc` \ rhs' ->