-reportableUnusedName :: Name -> Bool
-reportableUnusedName name
- = explicitlyImported (getNameProvenance name)
- where
- explicitlyImported (LocalDef _ _) = True
- -- Report unused defns of local vars
- explicitlyImported (NonLocalDef (UserImport _ _ expl) _) = expl
- -- Report unused explicit imports
- explicitlyImported other = False
- -- Don't report others
-
-rnStats :: [RenamedHsDecl] -> RnMG ()
-rnStats imp_decls
+ deprec_used deprec_env = [ (n,txt)
+ | n <- nameSetToList mentioned_names,
+ not (isLocallyDefined n),
+ Just txt <- [lookupNameEnv deprec_env n] ]
+ in
+ warnUnusedLocalBinds bad_locals `thenRn_`
+ warnUnusedImports bad_imps `thenRn_`
+ getIfacesRn `thenRn` \ ifaces ->
+ (if opt_WarnDeprecations
+ then mapRn_ warnDeprec (deprec_used (iDeprecs ifaces))
+ else returnRn ())
+
+warnDeprec :: (Name, DeprecTxt) -> RnM d ()
+warnDeprec (name, txt)
+ = pushSrcLocRn (getSrcLoc name) $
+ addWarnRn $
+ sep [ text "Using deprecated entity" <+> ppr name <> colon, nest 4 (ppr txt) ]
+
+rnDump :: [RenamedHsDecl] -- Renamed imported decls
+ -> [RenamedHsDecl] -- Renamed local decls
+ -> RnMG (IO ())
+rnDump imp_decls decls