The Id for a foreign import should be a LocalId, not a GlobalId.
Making it a GlobalId violates the invariant that all Ids defined in
the current module should be LocalIds until CoreTidy.
-- of the foreign type.
(_, t_ty) = tcSplitForAllTys sig_ty
(arg_tys, res_ty) = tcSplitFunTys t_ty
-- of the foreign type.
(_, t_ty) = tcSplitForAllTys sig_ty
(arg_tys, res_ty) = tcSplitFunTys t_ty
- id = mkVanillaGlobal nm sig_ty noCafIdInfo
- -- Foreign-imported things don't neeed zonking etc
- -- They are rather like constructors; we make the final
- -- Global Id right away.
+ id = mkLocalId nm sig_ty
+ -- Use a LocalId to obey the invariant that locally-defined
+ -- things are LocalIds. However, it does not need zonking,
+ -- (so TcHsSyn.zonkForeignExports ignores it).
in
tcCheckFIType sig_ty arg_tys res_ty imp_decl `thenM_`
-- can't use sig_ty here because it :: Type and we need HsType Id
in
tcCheckFIType sig_ty arg_tys res_ty imp_decl `thenM_`
-- can't use sig_ty here because it :: Type and we need HsType Id