From: simonpj Date: Wed, 9 Oct 2002 15:16:53 +0000 (+0000) Subject: [project @ 2002-10-09 15:16:53 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~1583 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d73de65b602088d2eec20ec524a38c3f577d9b05;p=ghc-hetmet.git [project @ 2002-10-09 15:16:53 by simonpj] Dont complain about unused things bound by deriving clause --- diff --git a/ghc/compiler/rename/RnNames.lhs b/ghc/compiler/rename/RnNames.lhs index 3e440e9..f1c7992 100644 --- a/ghc/compiler/rename/RnNames.lhs +++ b/ghc/compiler/rename/RnNames.lhs @@ -29,7 +29,7 @@ import Module ( Module, ModuleName, moduleName, moduleNameUserString, unitModuleEnvByName, lookupModuleEnvByName, moduleEnvElts ) -import Name ( Name, nameSrcLoc, nameOccName, nameModule ) +import Name ( Name, nameSrcLoc, nameOccName, nameModule, isExternalName ) import NameSet import NameEnv import OccName ( OccName, dataName, isTcOcc ) @@ -615,9 +615,15 @@ reportUnusedNames gbl_env used_names (defined_and_used, defined_but_not_used) = partition used defined_names used gre = gre_name gre `elemNameSet` really_used_names - -- Filter out the ones only defined implicitly + -- Filter out the ones that are + -- (a) defined in this module, and + -- (b) not defined by a 'deriving' clause + -- The latter have an Internal Name, so we can filter them out easily bad_locals :: [GlobalRdrElt] - bad_locals = filter isLocalGRE defined_but_not_used + bad_locals = filter is_bad defined_but_not_used + + is_bad :: GlobalRdrElt -> Bool + is_bad gre = isLocalGRE gre && isExternalName (gre_name gre) bad_imports :: [GlobalRdrElt] bad_imports = filter bad_imp defined_but_not_used