- -- No errors renaming source so rename the interfaces ...
--- _scc_ "preRnIfaces"
- let
- -- split up all names that occurred in the source; between
- -- those that are defined therein and those merely mentioned.
- -- We also divide by tycon/class and value names (as usual).
-
- occ_rns = [ rn | (rn,_) <- eltsUFM occ_fm ]
- -- all occurrence names, from this module and imported
-
- (defined_here, defined_elsewhere)
- = partition isLocallyDefined occ_rns
-
- (_, imports_used)
- = partition isRnWired defined_elsewhere
-
- (def_tcs, def_vals) = partition isRnTyConOrClass defined_here
- (occ_tcs, occ_vals) = partition isRnTyConOrClass occ_rns
- -- the occ stuff includes *all* occurrences,
- -- including those for which we have definitions
-
- (orig_def_env, orig_def_dups)
- = extendGlobalRnEnv emptyRnEnv (map pairify_rn def_vals)
- (map pairify_rn def_tcs)
- (orig_occ_env, orig_occ_dups)
- = extendGlobalRnEnv emptyRnEnv (map pairify_rn occ_vals)
- (map pairify_rn occ_tcs)
-
- -- This stuff is pretty dodgy right now: I think original
- -- names and occurrence names may be getting entangled
- -- when they shouldn't be... WDP 96/06
-
- pairify_rn rn -- ToDo: move to Name?
- = let
- name = getName rn
- in
- (if isLocalName name
- then Unqual (getLocalName name)
- else case (origName "pairify_rn" name) of { OrigName m n ->
- Qual m n }
- , rn)
-
- must_haves
- | opt_NoImplicitPrelude
- = [{-no Prelude.hi, no point looking-}]
- | otherwise
- = [ name_fn (mkWiredInName u orig ExportAll)
- | (orig@(OrigName mod str), (u, name_fn)) <- fmToList builtinKeysMap ]
- in
--- ASSERT (isEmptyBag orig_occ_dups)
- (if (isEmptyBag orig_occ_dups) then \x->x
- else pprTrace "orig_occ_dups:" (ppAboves [ ppCat [ppr PprDebug m, ppr PprDebug n, ppr PprDebug o] | (m,n,o) <- bagToList orig_occ_dups])) $
- ASSERT (isEmptyBag orig_def_dups)
-
--- _scc_ "rnIfaces"
- rnIfaces iface_cache imp_mods us3 orig_def_env orig_occ_env
- rn_module (must_haves {-initMustHaves-} ++ imports_used) >>=
- \ (rn_module_with_imports, final_env,
- (implicit_val_fm, implicit_tc_fm),
- usage_stuff,
- (iface_errs, iface_warns)) ->
-
- return (rn_module_with_imports,
- final_env,
- imp_mods,
- export_stuff,
- usage_stuff,
- errs_so_far `unionBags` iface_errs,
- warns_so_far `unionBags` iface_warns)