Commit d3d3c612 authored by qrczak's avatar qrczak
Browse files

[project @ 2000-08-18 06:34:26 by qrczak]

Unused Prelude import check moved to a better place.
parent ff833e2f
...@@ -764,8 +764,9 @@ reportUnusedNames mod_name direct_import_mods ...@@ -764,8 +764,9 @@ reportUnusedNames mod_name direct_import_mods
-- unused_imp_mods are the directly-imported modules -- unused_imp_mods are the directly-imported modules
-- that are not mentioned in minimal_imports -- that are not mentioned in minimal_imports
unused_imp_mods = [m | m <- direct_import_mods, unused_imp_mods = [m | m <- direct_import_mods,
not (maybeToBool (lookupFM minimal_imports m))] not (maybeToBool (lookupFM minimal_imports m)),
moduleName m /= pRELUDE_Name]
module_unused :: Name -> Bool module_unused :: Name -> Bool
-- Name is imported from a module that's completely unused, -- Name is imported from a module that's completely unused,
......
...@@ -36,7 +36,6 @@ import OccName ( OccName, ...@@ -36,7 +36,6 @@ import OccName ( OccName,
import TysWiredIn ( listTyCon ) import TysWiredIn ( listTyCon )
import Type ( funTyCon ) import Type ( funTyCon )
import Module ( ModuleName, mkThisModule, moduleName, mkVanillaModule, pprModuleName ) import Module ( ModuleName, mkThisModule, moduleName, mkVanillaModule, pprModuleName )
import PrelInfo ( pRELUDE_Name )
import FiniteMap import FiniteMap
import UniqSupply import UniqSupply
import SrcLoc ( SrcLoc, noSrcLoc ) import SrcLoc ( SrcLoc, noSrcLoc )
...@@ -709,8 +708,7 @@ mapFvRn f xs = mapRn f xs `thenRn` \ stuff -> ...@@ -709,8 +708,7 @@ mapFvRn f xs = mapRn f xs `thenRn` \ stuff ->
warnUnusedModules :: [Module] -> RnM d () warnUnusedModules :: [Module] -> RnM d ()
warnUnusedModules mods warnUnusedModules mods
| not opt_WarnUnusedImports = returnRn () | not opt_WarnUnusedImports = returnRn ()
| otherwise = mapRn_ (addWarnRn . unused_mod) $ | otherwise = mapRn_ (addWarnRn . unused_mod . moduleName) mods
filter (/= pRELUDE_Name) (map moduleName mods)
where where
unused_mod m = vcat [ptext SLIT("Module") <+> quotes (pprModuleName m) <+> unused_mod m = vcat [ptext SLIT("Module") <+> quotes (pprModuleName m) <+>
text "is imported, but nothing from it is used", text "is imported, but nothing from it is used",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment