From 4b7d8ae0cdf92b0d8789676a4be89b41a4582472 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Sun, 6 Mar 2011 00:02:16 +0000 Subject: [PATCH] Document -fwarn-missing-import-lists Also change the behaviour slightly, to warn only for *unqualified* imports. See Trac #4977. --- compiler/rename/RnNames.lhs | 4 +++- docs/users_guide/using.xml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs index a756c7f..3a20ac4 100644 --- a/compiler/rename/RnNames.lhs +++ b/compiler/rename/RnNames.lhs @@ -112,8 +112,9 @@ rnImportDecl this_mod implicit_prelude -- (Opt_WarnMissingImportList also checks for T(..) items -- but that is done in checkDodgyImport below) case imp_details of - Just (False, _) -> return () + Just (False, _) -> return () -- Explicit import list _ | implicit_prelude -> return () + | qual_only -> return () | otherwise -> ifDOptM Opt_WarnMissingImportList $ addWarn (missingImportListWarn imp_mod_name) @@ -586,6 +587,7 @@ filterImports iface decl_spec (Just (want_hiding, import_items)) all_avails = ifDOptM Opt_WarnDodgyImports (addWarn (dodgyImportWarn n)) -- NB. use the RdrName for reporting the warning | IEThingAll {} <- ieRdr + , not (is_qual decl_spec) = ifDOptM Opt_WarnMissingImportList $ addWarn (missingImportListItem ieRdr) checkDodgyImport _ diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index 34f769a..cc5045e 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -1300,6 +1300,36 @@ f foo = foo { x = 6 } + + : + + missing import lists, warning + import lists, missing + + + + This flag warns if you use an unqualified + import declaration + that does not explicitly list the entities brought into scope. For + example + +module M where + import X( f ) + import Y + import qualified Z + p x = f x x + + The flag will warn about the import + of Y but not X + If module Y is later changed to export (say) f, + then the reference to f in M will become + ambiguous. No warning is produced for the import of Z + because extending Z's exports would be unlikely to produce + ambiguity in M. + + + + : -- 1.7.10.4