diff options
-rw-r--r-- | compiler/main/DynFlags.hs | 31 | ||||
-rw-r--r-- | compiler/rename/RnNames.hs | 12 | ||||
-rw-r--r-- | compiler/stranal/DmdAnal.hs | 3 | ||||
-rw-r--r-- | compiler/typecheck/TcBinds.hs | 8 | ||||
-rw-r--r-- | docs/users_guide/8.0.1-notes.rst | 16 | ||||
-rw-r--r-- | docs/users_guide/debugging.rst | 2 | ||||
-rw-r--r-- | docs/users_guide/using-warnings.rst | 49 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T11053.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/T10908.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/all.T | 6 | ||||
-rw-r--r-- | utils/mkUserGuidePart/Options/CompilerDebugging.hs | 2 | ||||
-rw-r--r-- | utils/mkUserGuidePart/Options/Warnings.hs | 15 |
14 files changed, 101 insertions, 51 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index f92cf9beb2..3d23a090e6 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -335,7 +335,7 @@ data DumpFlag | Opt_D_dump_stg | Opt_D_dump_call_arity | Opt_D_dump_stranal - | Opt_D_dump_strsigs + | Opt_D_dump_str_signatures | Opt_D_dump_tc | Opt_D_dump_types | Opt_D_dump_rules @@ -548,8 +548,8 @@ data WarningFlag = | Opt_WarnMissingFields | Opt_WarnMissingImportList | Opt_WarnMissingMethods - | Opt_WarnMissingSigs - | Opt_WarnMissingLocalSigs + | Opt_WarnMissingSignatures + | Opt_WarnMissingLocalSignatures | Opt_WarnNameShadowing | Opt_WarnOverlappingPatterns | Opt_WarnTypeDefaults @@ -588,14 +588,14 @@ data WarningFlag = | Opt_WarnInlineRuleShadowing | Opt_WarnTypedHoles | Opt_WarnPartialTypeSignatures - | Opt_WarnMissingExportedSigs + | Opt_WarnMissingExportedSignatures | Opt_WarnUntickedPromotedConstructors | Opt_WarnDerivingTypeable | Opt_WarnDeferredTypeErrors | Opt_WarnNonCanonicalMonadInstances -- since 8.0 | Opt_WarnNonCanonicalMonadFailInstances -- since 8.0 | Opt_WarnNonCanonicalMonoidInstances -- since 8.0 - | Opt_WarnMissingPatSynSigs -- since 8.0 + | Opt_WarnMissingPatternSynonymSignatures -- since 8.0 | Opt_WarnUnrecognisedWarningFlags -- since 8.0 deriving (Eq, Show, Enum) @@ -2629,8 +2629,8 @@ dynamic_flags_deps = [ (setDumpFlag Opt_D_dump_call_arity) , make_ord_flag defGhcFlag "ddump-stranal" (setDumpFlag Opt_D_dump_stranal) - , make_ord_flag defGhcFlag "ddump-strsigs" - (setDumpFlag Opt_D_dump_strsigs) + , make_ord_flag defGhcFlag "ddump-str-signatures" + (setDumpFlag Opt_D_dump_str_signatures) , make_ord_flag defGhcFlag "ddump-tc" (setDumpFlag Opt_D_dump_tc) , make_ord_flag defGhcFlag "ddump-types" @@ -3183,12 +3183,16 @@ wWarningFlagsDeps = [ flagSpec "identities" Opt_WarnIdentities, flagSpec "missing-fields" Opt_WarnMissingFields, flagSpec "missing-import-lists" Opt_WarnMissingImportList, - flagSpec "missing-local-sigs" Opt_WarnMissingLocalSigs, + depFlagSpec "missing-local-sigs" Opt_WarnMissingLocalSignatures + "it is replaced by -Wmissing-local-signatures", + flagSpec "missing-local-signatures" Opt_WarnMissingLocalSignatures, flagSpec "missing-methods" Opt_WarnMissingMethods, flagSpec "missing-monadfail-instances" Opt_WarnMissingMonadFailInstances, flagSpec "semigroup" Opt_WarnSemigroup, - flagSpec "missing-signatures" Opt_WarnMissingSigs, - flagSpec "missing-exported-sigs" Opt_WarnMissingExportedSigs, + flagSpec "missing-signatures" Opt_WarnMissingSignatures, + depFlagSpec "missing-exported-sigs" Opt_WarnMissingExportedSignatures + "it is replaced by -Wmissing-exported-signatures", + flagSpec "missing-exported-signatures" Opt_WarnMissingExportedSignatures, flagSpec "monomorphism-restriction" Opt_WarnMonomorphism, flagSpec "name-shadowing" Opt_WarnNameShadowing, flagSpec "noncanonical-monad-instances" @@ -3225,7 +3229,8 @@ wWarningFlagsDeps = [ flagSpec "unused-type-patterns" Opt_WarnUnusedTypePatterns, flagSpec "warnings-deprecations" Opt_WarnWarningsDeprecations, flagSpec "wrong-do-bind" Opt_WarnWrongDoBind, - flagSpec "missing-pat-syn-signatures" Opt_WarnMissingPatSynSigs, + flagSpec "missing-pattern-synonym-signatures" + Opt_WarnMissingPatternSynonymSignatures, flagSpec "unrecognised-warning-flags" Opt_WarnUnrecognisedWarningFlags ] -- | These @-\<blah\>@ flags can all be reversed with @-no-\<blah\>@ @@ -3798,13 +3803,13 @@ minusWallOpts = minusWOpts ++ [ Opt_WarnTypeDefaults, Opt_WarnNameShadowing, - Opt_WarnMissingSigs, + Opt_WarnMissingSignatures, Opt_WarnHiShadows, Opt_WarnOrphans, Opt_WarnUnusedDoBind, Opt_WarnTrustworthySafe, Opt_WarnUntickedPromotedConstructors, - Opt_WarnMissingPatSynSigs + Opt_WarnMissingPatternSynonymSignatures ] -- | Things you get with -Weverything, i.e. *all* known warnings flags diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index d8e08e20aa..75191adc74 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -1480,7 +1480,7 @@ reportUnusedNames _export_decls gbl_env = do { traceRn ((text "RUN") <+> (ppr (tcg_dus gbl_env))) ; warnUnusedImportDecls gbl_env ; warnUnusedTopBinds unused_locals - ; warnMissingSigs gbl_env } + ; warnMissingSignatures gbl_env } where used_names :: NameSet used_names = findUses (tcg_dus gbl_env) emptyNameSet @@ -1556,8 +1556,8 @@ warnUnusedImportDecls gbl_env printMinimalImports usage } -- | Warn the user about top level binders that lack type signatures. -warnMissingSigs :: TcGblEnv -> RnM () -warnMissingSigs gbl_env +warnMissingSignatures :: TcGblEnv -> RnM () +warnMissingSignatures gbl_env = do { let exports = availsToNameSet (tcg_exports gbl_env) sig_ns = tcg_sigs gbl_env binds = tcg_binds gbl_env @@ -1565,9 +1565,9 @@ warnMissingSigs gbl_env -- Warn about missing signatures -- Do this only when we we have a type to offer - ; warn_missing_sigs <- woptM Opt_WarnMissingSigs - ; warn_only_exported <- woptM Opt_WarnMissingExportedSigs - ; warn_pat_syns <- woptM Opt_WarnMissingPatSynSigs + ; warn_missing_sigs <- woptM Opt_WarnMissingSignatures + ; warn_only_exported <- woptM Opt_WarnMissingExportedSignatures + ; warn_pat_syns <- woptM Opt_WarnMissingPatternSynonymSignatures ; let sig_warn | warn_only_exported = topSigWarnIfExported exports sig_ns diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index f7dbdde8a2..6ef911f6c0 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -48,7 +48,8 @@ dmdAnalProgram :: DynFlags -> FamInstEnvs -> CoreProgram -> IO CoreProgram dmdAnalProgram dflags fam_envs binds = do { let { binds_plus_dmds = do_prog binds } ; - dumpIfSet_dyn dflags Opt_D_dump_strsigs "Strictness signatures" $ + dumpIfSet_dyn dflags Opt_D_dump_str_signatures + "Strictness signatures" $ dumpStrSig binds_plus_dmds ; return binds_plus_dmds } diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index 495a442fa1..58f3761c4a 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -706,7 +706,7 @@ mkExport prag_fn qtvs theta else addErrCtxtM (mk_impedence_match_msg mono_info sel_poly_ty poly_ty) $ tcSubType_NC sig_ctxt sel_poly_ty (mkCheckExpType poly_ty) - ; warn_missing_sigs <- woptM Opt_WarnMissingLocalSigs + ; warn_missing_sigs <- woptM Opt_WarnMissingLocalSignatures ; when warn_missing_sigs $ localSigWarn poly_id mb_sig ; return (ABE { abe_wrap = wrap @@ -855,12 +855,12 @@ localSigWarn :: Id -> Maybe TcIdSigInfo -> TcM () localSigWarn id mb_sig | Just _ <- mb_sig = return () | not (isSigmaTy (idType id)) = return () - | otherwise = warnMissingSig msg id + | otherwise = warnMissingSignatures msg id where msg = text "Polymorphic local binding with no type signature:" -warnMissingSig :: SDoc -> Id -> TcM () -warnMissingSig msg id +warnMissingSignatures :: SDoc -> Id -> TcM () +warnMissingSignatures msg id = do { env0 <- tcInitTidyEnv ; let (env1, tidy_ty) = tidyOpenType env0 (idType id) ; addWarnTcM (env1, mk_msg tidy_ty) } diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 7a7bd25f1d..5943ed23ce 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -271,9 +271,10 @@ Compiler warnings makes sure the definition of ``Semigroup`` as a superclass of ``Monoid`` does not break any code. -- Added the :ghc-flag:`-Wmissing-pat-syn-signatures` flag. When enabled, this will issue - a warning when a pattern synonym definition doesn't have a type signature. - It is turned off by default but enabled by :ghc-flag:`-Wall`. +- Added the :ghc-flag:`-Wmissing-pattern-synonym-signatures` + flag. When enabled, this will issue a warning when a pattern + synonym definition doesn't have a type signature. It is turned off + by default but enabled by :ghc-flag:`-Wall`. - Added the :ghc-flag:`-Wunused-type-patterns` flag to report unused type variables in data and type family instances. This flag is not implied @@ -310,6 +311,15 @@ Compiler typecheck, ``Control.Exception.TypeError`` will now be thrown instead of ``Control.Exception.ErrorCall``. +- :ghc-flag:`-Wmissing-local-sigs` is now deprecated in favor of + :ghc-flag:`-Wmissing-local-signatures`. + +- :ghc-flag:`-Wmissing-exported-sigs` is now deprecated in favor of + :ghc-flag:`-Wmissing-exported-signatures`. + +- :ghc-flag:`-ddump-strsigs` has been renamed to + :ghc-flag:`-ddump-str-signatures`. + GHCi ~~~~ diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst index a4e2d2345f..f3d2009ad1 100644 --- a/docs/users_guide/debugging.rst +++ b/docs/users_guide/debugging.rst @@ -105,7 +105,7 @@ Dumping out compiler intermediate structures Dump strictness analyser output - .. ghc-flag:: -ddump-strsigs + .. ghc-flag:: -ddump-str-signatures Dump strictness signatures diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index e71ae927ef..24f8039451 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -62,8 +62,8 @@ The following flags are simple ways to select standard "packages" of warnings: * :ghc-flag:`-Wincomplete-record-updates` * :ghc-flag:`-Wmonomorphism-restriction` * :ghc-flag:`-Wimplicit-prelude` - * :ghc-flag:`-Wmissing-local-sigs` - * :ghc-flag:`-Wmissing-exported-sigs` + * :ghc-flag:`-Wmissing-local-signatures` + * :ghc-flag:`-Wmissing-exported-signatures` * :ghc-flag:`-Wmissing-import-lists` * :ghc-flag:`-Widentities` @@ -598,32 +598,51 @@ of ``-W(no-)*``. .. index:: single: type signatures, missing + This option is now deprecated in favour of + :ghc-flag:`-Wmissing-exported-signatures`. + +.. ghc-flag:: -Wmissing-exported-signatures + + .. index:: + single: type signatures, missing + If you would like GHC to check that every exported top-level function/value has a type signature, but not check unexported - values, use the :ghc-flag:`-Wmissing-exported-sigs` option. This option - takes precedence over :ghc-flag:`-Wmissing-signatures`. As part of the - warning GHC also reports the inferred type. The option is off by - default. + values, use the :ghc-flag:`-Wmissing-exported-signatures` + option. This option takes precedence over + :ghc-flag:`-Wmissing-signatures`. As part of the warning GHC also + reports the inferred type. The option is off by default. .. ghc-flag:: -Wmissing-local-sigs .. index:: single: type signatures, missing - If you use the :ghc-flag:`-Wmissing-local-sigs` flag GHC will warn you - about any polymorphic local bindings. As part of the warning GHC - also reports the inferred type. The option is off by default. + This option is now deprecated in favour of + :ghc-flag:`-Wmissing-local-signatures`. + +.. ghc-flag:: -Wmissing-local-signatures + + .. index:: + single: type signatures, missing + + If you use the :ghc-flag:`-Wmissing-local-signatures` flag GHC + will warn you about any polymorphic local bindings. As part of the + warning GHC also reports the inferred type. The option is off by + default. -.. ghc-flag:: -Wmissing-pat-syn-signatures +.. ghc-flag:: -Wmissing-pattern-synonym-signatures .. index:: single: type signatures, missing, pattern synonyms - If you would like GHC to check that every pattern synonym has a type - signature, use the :ghc-flag:`-Wmissing-pat-syn-signatures` option. If this option is - used in conjunction with :ghc-flag:`-Wmissing-exported-sigs` then only - exported pattern synonyms must have a type signature. GHC also reports the - inferred type. This option is off by default. + If you would like GHC to check that every pattern synonym has a + type signature, use the + :ghc-flag:`-Wmissing-pattern-synonym-signatures` option. If this + option is used in conjunction with + :ghc-flag:`-Wmissing-exported-signatures` then only exported pattern + synonyms must have a type signature. GHC also reports the inferred + type. This option is off by default. .. ghc-flag:: -Wname-shadowing diff --git a/testsuite/tests/patsyn/should_fail/T11053.hs b/testsuite/tests/patsyn/should_fail/T11053.hs index 1ef3026186..397679ab0b 100644 --- a/testsuite/tests/patsyn/should_fail/T11053.hs +++ b/testsuite/tests/patsyn/should_fail/T11053.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PatternSynonyms #-} --- turn on with -fwarn-missing-pat-syn-signatures +-- turn on with -fwarn-missing-pattern-synonym-signatures module Foo where diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 871d623dad..a091882e18 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -26,6 +26,6 @@ test('poly-export-fail2', expect_broken(10653), compile_fail, ['']) test('export-super-class-fail', expect_broken(10653), compile_fail, ['']) test('export-type-synonym', normal, compile_fail, ['']) test('export-ps-rec-sel', normal, compile_fail, ['']) -test('T11053', normal, compile, ['-fwarn-missing-pat-syn-signatures']) +test('T11053', normal, compile, ['-fwarn-missing-pattern-synonym-signatures']) test('T10426', normal, compile_fail, ['']) test('T11265', normal, compile_fail, ['']) diff --git a/testsuite/tests/stranal/sigs/all.T b/testsuite/tests/stranal/sigs/all.T index 9accd01af5..d5689afece 100644 --- a/testsuite/tests/stranal/sigs/all.T +++ b/testsuite/tests/stranal/sigs/all.T @@ -1,7 +1,7 @@ # This directory contains tests where we annotate functions with expected # type signatures, and verify that these actually those found by the compiler -setTestOpts(extra_hc_opts('-ddump-strsigs')) +setTestOpts(extra_hc_opts('-ddump-str-signatures')) # We are testing the result of an optimization, so no use # running them in various runtimes diff --git a/testsuite/tests/warnings/should_compile/T10908.hs b/testsuite/tests/warnings/should_compile/T10908.hs index a9af541df9..09056f938a 100644 --- a/testsuite/tests/warnings/should_compile/T10908.hs +++ b/testsuite/tests/warnings/should_compile/T10908.hs @@ -1,4 +1,4 @@ -{-# OPTIONS_GHC -fwarn-missing-exported-sigs #-} +{-# OPTIONS_GHC -fwarn-missing-exported-signatures #-} module Bug (Data.List.intercalate, x) where diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T index 2e7132213c..3631202187 100644 --- a/testsuite/tests/warnings/should_compile/all.T +++ b/testsuite/tests/warnings/should_compile/all.T @@ -1,11 +1,11 @@ -# -fwarn-missing-exported-sigs should take precedence over -fwarn-missing-signatures -test('T2526', normal, compile, ['-fwarn-missing-signatures -fwarn-missing-exported-sigs']) +# -fwarn-missing-exported-signatures should take precedence over -fwarn-missing-signatures +test('T2526', normal, compile, ['-fwarn-missing-signatures -fwarn-missing-exported-signatures']) test('T9178', extra_clean(['T9178.o', 'T9178DataType.o', 'T9178.hi', 'T9178DataType.hi']), multimod_compile, ['T9178', '-Wall']) test('T9230', normal, compile_without_flag('-fno-warn-tabs'), ['']) test('T10908', normal, compile, ['']) -test('T11077', normal, compile, ['-fwarn-missing-exported-sigs']) +test('T11077', normal, compile, ['-fwarn-missing-exported-signatures']) test('T11128', normal, compile, ['']) test('T11128b', normal, compile, ['']) test('PluralS', normal, compile, ['']) diff --git a/utils/mkUserGuidePart/Options/CompilerDebugging.hs b/utils/mkUserGuidePart/Options/CompilerDebugging.hs index 3f1d89999d..ce84a2a48b 100644 --- a/utils/mkUserGuidePart/Options/CompilerDebugging.hs +++ b/utils/mkUserGuidePart/Options/CompilerDebugging.hs @@ -120,7 +120,7 @@ compilerDebuggingOptions = , flagDescription = "Dump strictness analyser output" , flagType = DynamicFlag } - , flag { flagName = "-ddump-strsigs" + , flag { flagName = "-ddump-str-signatures" , flagDescription = "Dump strictness signatures" , flagType = DynamicFlag } diff --git a/utils/mkUserGuidePart/Options/Warnings.hs b/utils/mkUserGuidePart/Options/Warnings.hs index 37597f8e0f..a72395e194 100644 --- a/utils/mkUserGuidePart/Options/Warnings.hs +++ b/utils/mkUserGuidePart/Options/Warnings.hs @@ -141,17 +141,32 @@ warningsOptions = } , flag { flagName = "-Wmissing-exported-sigs" , flagDescription = + "*(deprecated)* "++ "warn about top-level functions without signatures, only if they "++ "are exported. takes precedence over -Wmissing-signatures" , flagType = DynamicFlag , flagReverse = "-Wno-missing-exported-sigs" } + , flag { flagName = "-Wmissing-exported-signatures" + , flagDescription = + "warn about top-level functions without signatures, only if they "++ + "are exported. takes precedence over -Wmissing-signatures" + , flagType = DynamicFlag + , flagReverse = "-Wno-missing-exported-signatures" + } , flag { flagName = "-Wmissing-local-sigs" , flagDescription = + "*(deprecated)* "++ "warn about polymorphic local bindings without signatures" , flagType = DynamicFlag , flagReverse = "-Wno-missing-local-sigs" } + , flag { flagName = "-Wmissing-local-signatures" + , flagDescription = + "warn about polymorphic local bindings without signatures" + , flagType = DynamicFlag + , flagReverse = "-Wno-missing-local-signatures" + } , flag { flagName = "-Wmissing-monadfail-instances" , flagDescription = "warn when a failable pattern is used in a do-block that does " ++ |