From: simonpj Date: Thu, 26 Feb 2004 14:49:05 +0000 (+0000) Subject: [project @ 2004-02-26 14:49:05 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~54 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=06da60e3b9ac6940cd44cdfcbebaf45a2e955759;p=ghc-hetmet.git [project @ 2004-02-26 14:49:05 by simonpj] Back out hiding change -- hiding should hide the qualified name too --- diff --git a/ghc/compiler/rename/RnNames.lhs b/ghc/compiler/rename/RnNames.lhs index 7bc2cce..37399d2 100644 --- a/ghc/compiler/rename/RnNames.lhs +++ b/ghc/compiler/rename/RnNames.lhs @@ -411,29 +411,30 @@ filterImports :: ModIface -- Complains if import spec mentions things that the module doesn't export -- Warns/informs if import spec contains duplicates. +mkGenericRdrEnv imp_spec avails + = mkGlobalRdrEnv [ GRE { gre_name = name, gre_prov = Imported [imp_spec] False } + | avail <- avails, name <- availNames avail ] + filterImports iface imp_spec Nothing total_avails = returnM (mkAvailEnv total_avails, - mkGlobalRdrEnv [ GRE { gre_name = name, gre_prov = Imported [imp_spec] False } - | avail <- total_avails, name <- availNames avail ]) + mkGenericRdrEnv imp_spec total_avails) filterImports iface imp_spec (Just (want_hiding, import_items)) total_avails = mapAndUnzipM (addLocM get_item) import_items `thenM` \ (avails_s, gres) -> let avails = concat avails_s - rdr_env | not want_hiding - = foldr plusGlobalRdrEnv emptyGlobalRdrEnv gres - | otherwise -- Hiding; qualified-only import of hidden things - = mkGlobalRdrEnv [ GRE { gre_name = name, - gre_prov = Imported [mk_imp_spec name] False } - | avail <- total_avails, name <- availNames avail ] - hidden = availsToNameSet avails - mk_imp_spec n - | n `elemNameSet` hidden = imp_spec { is_qual = True } - | otherwise = imp_spec in - returnM (mkAvailEnv avails, rdr_env) - -- Hiding still imports everything qualified, so 'avails' is not - -- conditional on hiding. But the rdrenv is modified to + if not want_hiding then + return (mkAvailEnv avails, + foldr plusGlobalRdrEnv emptyGlobalRdrEnv gres) + else + let + hidden = availsToNameSet avails + keep n = not (n `elemNameSet` hidden) + pruned_avails = pruneAvails keep total_avails + in + return (mkAvailEnv pruned_avails, + mkGenericRdrEnv imp_spec pruned_avails) where import_fm :: OccEnv AvailInfo