X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Frename%2FRnNames.lhs;h=4b5bb2617a297bbe2a6b4971134b1b5bbab8b48e;hb=508a505e9853984bfdaa3ad855ae3fcbc6d31787;hp=8ae1e5375e38b4b5b70ae39d9b84c85ba83a6e1b;hpb=f9d8c8e0ab44b24d06b654d98543e8b39d4ebeca;p=ghc-hetmet.git diff --git a/ghc/compiler/rename/RnNames.lhs b/ghc/compiler/rename/RnNames.lhs index 8ae1e53..4b5bb26 100644 --- a/ghc/compiler/rename/RnNames.lhs +++ b/ghc/compiler/rename/RnNames.lhs @@ -14,8 +14,8 @@ module RnNames ( import CmdLineOpts ( DynFlag(..) ) import HsSyn ( IE(..), ieName, ImportDecl(..), LImportDecl, - ForeignDecl(..), HsGroup(..), - collectGroupBinders, tyClDeclNames + ForeignDecl(..), HsGroup(..), HsBindGroup(..), + Sig(..), collectGroupBinders, tyClDeclNames ) import RnEnv import IfaceEnv ( lookupOrig, newGlobalBinder ) @@ -380,12 +380,21 @@ getLocalDeclBinders mod (HsGroup {hs_valds = val_decls, -- an export indicator because they are all implicitly exported. mappM new_tc tycl_decls `thenM` \ tc_avails -> - mappM new_simple (for_hs_bndrs ++ val_hs_bndrs) `thenM` \ simple_avails -> - returnM (tc_avails ++ simple_avails) + + -- In a hs-boot file, the value binders come from the + -- *signatures*, and there should be no foreign binders + tcIsHsBoot `thenM` \ is_hs_boot -> + let val_bndrs | is_hs_boot = sig_hs_bndrs + | otherwise = for_hs_bndrs ++ val_hs_bndrs + in + mappM new_simple val_bndrs `thenM` \ names -> + + returnM (tc_avails ++ map Avail names) where - new_simple rdr_name = newTopSrcBinder mod Nothing rdr_name `thenM` \ name -> - returnM (Avail name) + new_simple rdr_name = newTopSrcBinder mod Nothing rdr_name + sig_hs_bndrs = [nm | HsBindGroup _ lsigs _ <- val_decls, + L _ (Sig nm _) <- lsigs] val_hs_bndrs = collectGroupBinders val_decls for_hs_bndrs = [nm | L _ (ForeignImport nm _ _ _) <- foreign_decls]