[project @ 2003-04-11 13:04:37 by simonmar]
authorsimonmar <unknown>
Fri, 11 Apr 2003 13:04:37 +0000 (13:04 +0000)
committersimonmar <unknown>
Fri, 11 Apr 2003 13:04:37 +0000 (13:04 +0000)
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.

ghc/compiler/typecheck/TcForeign.lhs

index bcf44f1..1748128 100644 (file)
@@ -86,10 +86,10 @@ tcFImport fo@(ForeignImport nm hs_ty imp_decl isDeprec src_loc)
       -- 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