summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/main/DynFlags.hs2
-rw-r--r--compiler/typecheck/TcRnExports.hs18
2 files changed, 16 insertions, 4 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index cbf3ab7622..ffc8614734 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -683,6 +683,7 @@ data WarningFlag =
| Opt_WarnUnbangedStrictPatterns -- Since 8.2
| Opt_WarnMissingHomeModules -- Since 8.2
| Opt_WarnPartialFields -- Since 8.4
+ | Opt_WarnMissingExportList
deriving (Eq, Show, Enum)
data Language = Haskell98 | Haskell2010
@@ -3639,6 +3640,7 @@ wWarningFlagsDeps = [
flagSpec "identities" Opt_WarnIdentities,
flagSpec "missing-fields" Opt_WarnMissingFields,
flagSpec "missing-import-lists" Opt_WarnMissingImportList,
+ flagSpec "missing-export-lists" Opt_WarnMissingExportList,
depFlagSpec "missing-local-sigs" Opt_WarnMissingLocalSignatures
"it is replaced by -Wmissing-local-signatures",
flagSpec "missing-local-signatures" Opt_WarnMissingLocalSignatures,
diff --git a/compiler/typecheck/TcRnExports.hs b/compiler/typecheck/TcRnExports.hs
index a79e30d5f2..e2b6a61bfa 100644
--- a/compiler/typecheck/TcRnExports.hs
+++ b/compiler/typecheck/TcRnExports.hs
@@ -181,10 +181,15 @@ exports_from_avail Nothing rdr_env _imports _this_mod
-- The same as (module M) where M is the current module name,
-- so that's how we handle it, except we also export the data family
-- when a data instance is exported.
- = let avails =
- map fix_faminst . gresToAvailInfo
- . filter isLocalGRE . globalRdrEnvElts $ rdr_env
- in return (Nothing, avails)
+ = do {
+ ; warnMissingExportList <- woptM Opt_WarnMissingExportList
+ ; warnIfFlag Opt_WarnMissingExportList
+ warnMissingExportList
+ (missingModuleExportWarn $ moduleName _this_mod)
+ ; let avails =
+ map fix_faminst . gresToAvailInfo
+ . filter isLocalGRE . globalRdrEnvElts $ rdr_env
+ ; return (Nothing, avails) }
where
-- #11164: when we define a data instance
-- but not data family, re-export the family
@@ -659,6 +664,11 @@ nullModuleExport :: ModuleName -> SDoc
nullModuleExport mod
= text "The export item `module" <+> ppr mod <> ptext (sLit "' exports nothing")
+missingModuleExportWarn :: ModuleName -> SDoc
+missingModuleExportWarn mod
+ = text "The export item `module" <+> ppr mod <>
+ ptext (sLit "' is missing an export list")
+
dodgyExportWarn :: Name -> SDoc
dodgyExportWarn item