summaryrefslogtreecommitdiff
path: root/ghc/compiler/rename/RnEnv.lhs
diff options
context:
space:
mode:
authorsimonpj <unknown>2004-05-25 08:09:42 +0000
committersimonpj <unknown>2004-05-25 08:09:42 +0000
commitc6713d35dd3ed4de580a513bf4bd46f70d8cfe5d (patch)
treea136098b7a62311479542d879e7e0aac6814f993 /ghc/compiler/rename/RnEnv.lhs
parent5220fda752f65ac62bd9f5269c11a7f345293f69 (diff)
downloadhaskell-c6713d35dd3ed4de580a513bf4bd46f70d8cfe5d.tar.gz
[project @ 2004-05-25 08:09:37 by simonpj]
----------------------------------------------- Improve location info on unused-import warnings ----------------------------------------------- Improving the location involves plumbing the location of the import a bit more assiduously -- hence change to imp_mods in TcRnTypes
Diffstat (limited to 'ghc/compiler/rename/RnEnv.lhs')
-rw-r--r--ghc/compiler/rename/RnEnv.lhs11
1 files changed, 6 insertions, 5 deletions
diff --git a/ghc/compiler/rename/RnEnv.lhs b/ghc/compiler/rename/RnEnv.lhs
index 1185fe5dfc..dfd2fda935 100644
--- a/ghc/compiler/rename/RnEnv.lhs
+++ b/ghc/compiler/rename/RnEnv.lhs
@@ -54,7 +54,7 @@ import Module ( Module, ModuleName, moduleName, mkHomeModule )
import PrelNames ( mkUnboundName, rOOT_MAIN_Name, iNTERACTIVE )
import UniqSupply
import BasicTypes ( IPName, mapIPName )
-import SrcLoc ( srcSpanStart, Located(..), eqLocated, unLoc,
+import SrcLoc ( SrcSpan, srcSpanStart, Located(..), eqLocated, unLoc,
srcLocSpan )
import Outputable
import ListSetOps ( removeDups )
@@ -658,12 +658,13 @@ mapFvRn f xs = mappM f xs `thenM` \ stuff ->
%************************************************************************
\begin{code}
-warnUnusedModules :: [ModuleName] -> RnM ()
+warnUnusedModules :: [(ModuleName,SrcSpan)] -> RnM ()
warnUnusedModules mods
- = ifOptM Opt_WarnUnusedImports (mappM_ (addWarn . unused_mod) mods)
+ = ifOptM Opt_WarnUnusedImports (mappM_ bleat mods)
where
- unused_mod m = vcat [ptext SLIT("Module") <+> quotes (ppr m) <+>
- text "is imported, but nothing from it is used",
+ bleat (mod,loc) = addSrcSpan loc $ addWarn (mk_warn mod)
+ mk_warn m = vcat [ptext SLIT("Module") <+> quotes (ppr m) <+>
+ text "is imported, but nothing from it is used",
parens (ptext SLIT("except perhaps instances visible in") <+>
quotes (ppr m))]