Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
2ee130cd
Commit
2ee130cd
authored
Jun 18, 2010
by
amsay@amsay.net
Browse files
trac
#1789
(warnings for missing import lists)
parent
54fffb96
Changes
3
Hide whitespace changes
Inline
Side-by-side
compiler/main/DynFlags.hs
View file @
2ee130cd
...
...
@@ -164,6 +164,7 @@ data DynFlag
|
Opt_WarnIncompletePatterns
|
Opt_WarnIncompletePatternsRecUpd
|
Opt_WarnMissingFields
|
Opt_WarnMissingImportList
|
Opt_WarnMissingMethods
|
Opt_WarnMissingSigs
|
Opt_WarnNameShadowing
...
...
@@ -1493,6 +1494,7 @@ fFlags = [
(
"warn-incomplete-patterns"
,
Opt_WarnIncompletePatterns
,
const
Supported
),
(
"warn-incomplete-record-updates"
,
Opt_WarnIncompletePatternsRecUpd
,
const
Supported
),
(
"warn-missing-fields"
,
Opt_WarnMissingFields
,
const
Supported
),
(
"warn-missing-import-lists"
,
Opt_WarnMissingImportList
,
const
Supported
),
(
"warn-missing-methods"
,
Opt_WarnMissingMethods
,
const
Supported
),
(
"warn-missing-signatures"
,
Opt_WarnMissingSigs
,
const
Supported
),
(
"warn-name-shadowing"
,
Opt_WarnNameShadowing
,
const
Supported
),
...
...
compiler/rename/RnNames.lhs
View file @
2ee130cd
...
...
@@ -70,8 +70,8 @@ rnImports imports
when (notNull prel_imports) $ addWarn (implicitPreludeWarn)
)
stuff1 <- mapM (rnImportDecl this_mod) (prel_imports ++ ordinary)
stuff2 <- mapM (rnImportDecl this_mod) source
stuff1 <- mapM (rnImportDecl this_mod
implicit_prelude
) (prel_imports ++ ordinary)
stuff2 <- mapM (rnImportDecl this_mod
implicit_prelude
) source
let (decls, rdr_env, imp_avails,hpc_usage) = combine (stuff1 ++ stuff2)
return (decls, rdr_env, imp_avails,hpc_usage)
...
...
@@ -86,11 +86,11 @@ rnImports imports
imp_avails1 `plusImportAvails` imp_avails2,
hpc_usage1 || hpc_usage2)
rnImportDecl :: Module
rnImportDecl :: Module
-> Bool
-> LImportDecl RdrName
-> RnM (LImportDecl Name, GlobalRdrEnv, ImportAvails,AnyHpcUsage)
rnImportDecl this_mod (L loc (ImportDecl loc_imp_mod_name mb_pkg want_boot
rnImportDecl this_mod
implicit_prelude
(L loc (ImportDecl loc_imp_mod_name mb_pkg want_boot
qual_only as_mod imp_details))
= setSrcSpan loc $ do
...
...
@@ -104,6 +104,11 @@ rnImportDecl this_mod (L loc (ImportDecl loc_imp_mod_name mb_pkg want_boot
imp_mod_name = unLoc loc_imp_mod_name
doc = ppr imp_mod_name <+> ptext (sLit "is directly imported")
case imp_details of
(Just _) -> return ()
Nothing -> when (not (implicit_prelude && imp_mod_name == pRELUDE_NAME)) $
ifOptM Opt_WarnMissingImportList (addWarn (missingImportListWarn imp_mod_name))
iface <- loadSrcInterface doc imp_mod_name want_boot mb_pkg
-- Compiler sanity check: if the import didn't say
...
...
@@ -1447,6 +1452,10 @@ nullModuleExport :: ModuleName -> SDoc
nullModuleExport mod
= ptext (sLit "The export item `module") <+> ppr mod <> ptext (sLit "' exports nothing")
missingImportListWarn :: ModuleName -> SDoc
missingImportListWarn mod
= ptext (sLit "The module") <+> quotes (ppr mod) <+> ptext (sLit "is missing an import list")
moduleWarn :: ModuleName -> WarningTxt -> SDoc
moduleWarn mod (WarningTxt txt)
= sep [ ptext (sLit "Module") <+> quotes (ppr mod) <> ptext (sLit ":"),
...
...
docs/users_guide/flags.xml
View file @
2ee130cd
...
...
@@ -1128,6 +1128,13 @@
<entry><option>
-fno-warn-missing-fields
</option></entry>
</row>
<row>
<entry><option>
-fwarn-missing-import-lists
</option></entry>
<entry>
warn when explicit imports lack an import list
</entry>
<entry>
dynamic
</entry>
<entry><option>
-fnowarn-missing-import-lists
</option></entry>
</row>
<row>
<entry><option>
-fwarn-missing-methods
</option></entry>
<entry>
warn when class methods are undefined
</entry>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment