diff options
author | simonpj@microsoft.com <unknown> | 2010-11-15 23:21:42 +0000 |
---|---|---|
committer | simonpj@microsoft.com <unknown> | 2010-11-15 23:21:42 +0000 |
commit | 2d367f855c3556166d24cf538d5c34d0ff596a2f (patch) | |
tree | 2a1e9453949f04b77a5d56d7aa13910df4c568bf | |
parent | bf6dd8335a357438a3cf60c8f3c4dbbf880ccb3f (diff) | |
download | haskell-2d367f855c3556166d24cf538d5c34d0ff596a2f.tar.gz |
Fix -fwarn-missing-import-lists (fix Trac #4489)
-rw-r--r-- | compiler/rename/RnNames.lhs | 23 | ||||
-rw-r--r-- | docs/users_guide/flags.xml | 3 |
2 files changed, 16 insertions, 10 deletions
diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs index a9a9c460b6..a1cadb32df 100644 --- a/compiler/rename/RnNames.lhs +++ b/compiler/rename/RnNames.lhs @@ -108,16 +108,14 @@ rnImportDecl this_mod implicit_prelude imp_mod_name = unLoc loc_imp_mod_name doc = ppr imp_mod_name <+> ptext (sLit "is directly imported") - let isExplicit lie = case unLoc lie of - IEThingAll _ -> False - _ -> True + -- Check for a missing import list + -- (Opt_WarnMissingImportList also checks for T(..) items + -- but that is done in checkDodgyImport below) case imp_details of - Just (False, lies) - | all isExplicit lies -> - return () - _ -> - unless implicit_prelude $ - ifDOptM Opt_WarnMissingImportList (addWarn (missingImportListWarn imp_mod_name)) + Just (False, _) -> return () + _ | implicit_prelude -> return () + | otherwise -> ifDOptM Opt_WarnMissingImportList $ + addWarn (missingImportListWarn imp_mod_name) iface <- loadSrcInterface doc imp_mod_name want_boot mb_pkg @@ -588,6 +586,9 @@ filterImports iface decl_spec (Just (want_hiding, import_items)) all_avails | IEThingAll n <- ieRdr, (_, AvailTC _ [_]):_ <- stuff = ifDOptM Opt_WarnDodgyImports (addWarn (dodgyImportWarn n)) -- NB. use the RdrName for reporting the warning + | IEThingAll {} <- ieRdr + = ifDOptM Opt_WarnMissingImportList $ + addWarn (missingImportListItem ieRdr) checkDodgyImport _ = return () @@ -1552,6 +1553,10 @@ missingImportListWarn :: ModuleName -> SDoc missingImportListWarn mod = ptext (sLit "The module") <+> quotes (ppr mod) <+> ptext (sLit "does not have an explicit import list") +missingImportListItem :: IE RdrName -> SDoc +missingImportListItem ie + = ptext (sLit "The import item") <+> quotes (ppr ie) <+> ptext (sLit "does not have an explicit import list") + moduleWarn :: ModuleName -> WarningTxt -> SDoc moduleWarn mod (WarningTxt txt) = sep [ ptext (sLit "Module") <+> quotes (ppr mod) <> ptext (sLit ":"), diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index b80ada7e14..8482a7c717 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -1143,7 +1143,8 @@ <row> <entry><option>-fwarn-missing-import-lists</option></entry> - <entry>warn when explicit imports lack an import list</entry> + <entry>warn when an import declaration does not explicitly + list all the names brought into scope</entry> <entry>dynamic</entry> <entry><option>-fnowarn-missing-import-lists</option></entry> </row> |