module RnNames (
rnImports, importsFromLocalDecls,
reportUnusedNames, reportDeprecations,
- mkModDeps, exportsToAvails, exportsFromAvail
+ mkModDeps, exportsFromAvail
) where
#include "HsVersions.h"
Sig(..), collectGroupBinders, tyClDeclNames
)
import RnEnv
-import IfaceEnv ( lookupAvail )
+import IfaceEnv ( ifaceExportNames )
import LoadIface ( loadSrcInterface )
import TcRnMonad
import OccName ( srcDataName, isTcOcc, occNameFlavour, OccEnv,
mkOccEnv, lookupOccEnv, emptyOccEnv, extendOccEnv )
import HscTypes ( GenAvailInfo(..), AvailInfo,
- IfaceExport, HomePackageTable, PackageIfaceTable,
+ HomePackageTable, PackageIfaceTable,
availNames, unQualInScope,
Deprecs(..), ModIface(..), Dependencies(..),
lookupIface, ExternalPackageState(..)
is_loc = loc, is_as = qual_mod_name }
in
-- Get the total imports, and filter them according to the import list
- exportsToAvails filtered_exports `thenM` \ total_avails ->
+ ifaceExportNames filtered_exports `thenM` \ total_avails ->
filterImports iface imp_spec
imp_details total_avails `thenM` \ (avail_env, gbl_env) ->
returnM (gbl_env, imports)
-exportsToAvails :: [IfaceExport] -> TcRnIf gbl lcl NameSet
-exportsToAvails exports
- = foldlM do_one emptyNameSet exports
- where
- do_one acc (mod, exports) = foldlM (do_avail mod) acc exports
- do_avail mod acc avail = do { ns <- lookupAvail mod avail
- ; return (addListToNameSet acc ns) }
-
warnRedundantSourceImport mod_name
= ptext SLIT("Unnecessary {- SOURCE -} in the import of module")
<+> quotes (ppr mod_name)
mappM new_tc tycl_decls `thenM` \ tc_avails ->
-- In a hs-boot file, the value binders come from the
- -- *signatures*, and there should be no foreign binders
+ -- *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
get_item item@(IEThingAbs n)
| want_hiding -- hiding( C )
-- Here the 'C' can be a data constructor
- -- *or* a type/class, or even both
+ -- *or* a type/class, or even both
= case concat [check_item item, check_item (IEVar data_n)] of
[] -> bale_out item
names -> succeed_with True names
where
env = mkOccEnv [(nameOccName s, s) | s <- subNames subs n]
mb_names = map (lookupOccEnv env . rdrNameOcc) rdrs
+filterAvail (IEModuleContents _) _ _ = panic "filterAvail"
subNames :: NameEnv [Name] -> Name -> [Name]
subNames env n = lookupNameEnv env n `orElse` []
warn (GRE { gre_name = name, gre_prov = Imported imps _ })
= addWarn ((quotes (ppr name) <+> ptext SLIT("is imported more than once:"))
$$ nest 2 (vcat (map ppr imps)))
+ warn gre = panic "warnDuplicateImports"
+ -- The GREs should all have Imported provenance
-- ToDo: deal with original imports with 'qualified' and 'as M' clauses