From d3d3c6122f19a9a936f3c0b6f10486faaa1055bd Mon Sep 17 00:00:00 2001 From: qrczak Date: Fri, 18 Aug 2000 06:34:26 +0000 Subject: [PATCH] [project @ 2000-08-18 06:34:26 by qrczak] Unused Prelude import check moved to a better place. --- ghc/compiler/rename/Rename.lhs | 5 +++-- ghc/compiler/rename/RnEnv.lhs | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ghc/compiler/rename/Rename.lhs b/ghc/compiler/rename/Rename.lhs index 68ac301..df72d31 100644 --- a/ghc/compiler/rename/Rename.lhs +++ b/ghc/compiler/rename/Rename.lhs @@ -764,8 +764,9 @@ reportUnusedNames mod_name direct_import_mods -- unused_imp_mods are the directly-imported modules -- that are not mentioned in minimal_imports - unused_imp_mods = [m | m <- direct_import_mods, - not (maybeToBool (lookupFM minimal_imports m))] + unused_imp_mods = [m | m <- direct_import_mods, + not (maybeToBool (lookupFM minimal_imports m)), + moduleName m /= pRELUDE_Name] module_unused :: Name -> Bool -- Name is imported from a module that's completely unused, diff --git a/ghc/compiler/rename/RnEnv.lhs b/ghc/compiler/rename/RnEnv.lhs index 7bd4302..4a8b0d3 100644 --- a/ghc/compiler/rename/RnEnv.lhs +++ b/ghc/compiler/rename/RnEnv.lhs @@ -36,7 +36,6 @@ import OccName ( OccName, import TysWiredIn ( listTyCon ) import Type ( funTyCon ) import Module ( ModuleName, mkThisModule, moduleName, mkVanillaModule, pprModuleName ) -import PrelInfo ( pRELUDE_Name ) import FiniteMap import UniqSupply import SrcLoc ( SrcLoc, noSrcLoc ) @@ -709,8 +708,7 @@ mapFvRn f xs = mapRn f xs `thenRn` \ stuff -> warnUnusedModules :: [Module] -> RnM d () warnUnusedModules mods | not opt_WarnUnusedImports = returnRn () - | otherwise = mapRn_ (addWarnRn . unused_mod) $ - filter (/= pRELUDE_Name) (map moduleName mods) + | otherwise = mapRn_ (addWarnRn . unused_mod . moduleName) mods where unused_mod m = vcat [ptext SLIT("Module") <+> quotes (pprModuleName m) <+> text "is imported, but nothing from it is used", -- 1.7.10.4