diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-11-21 22:32:29 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-23 01:08:05 -0500 |
commit | 3ab3631f41efe9a1ae32a5b1f709152228edb09a (patch) | |
tree | cdda5ddc1c2dc146512b98b56c76a9535e9bc021 /compiler/GHC/Driver/Flags.hs | |
parent | 1ed2aa90da7973283408a8a121103d596b05f81b (diff) | |
download | haskell-3ab3631f41efe9a1ae32a5b1f709152228edb09a.tar.gz |
Add a warning for GADT match + NoMonoLocalBinds (#20485)
Previously, it was an error to pattern match on a GADT
without GADTs or TypeFamilies.
This is now allowed. Instead, we check the flag MonoLocalBinds;
if it is not enabled, we issue a warning, controlled by -Wgadt-mono-local-binds.
Also fixes #20485: pattern synonyms are now checked too.
Diffstat (limited to 'compiler/GHC/Driver/Flags.hs')
-rw-r--r-- | compiler/GHC/Driver/Flags.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs index 192b983887..02b42b1dcd 100644 --- a/compiler/GHC/Driver/Flags.hs +++ b/compiler/GHC/Driver/Flags.hs @@ -538,6 +538,7 @@ data WarningFlag = | Opt_WarnRedundantStrictnessFlags -- Since 9.4 | Opt_WarnForallIdentifier -- Since 9.4 | Opt_WarnUnicodeBidirectionalFormatCharacters -- Since 9.0.2 + | Opt_WarnGADTMonoLocalBinds -- Since 9.4 deriving (Eq, Ord, Show, Enum) -- | Return the names of a WarningFlag @@ -639,6 +640,7 @@ warnFlagNames wflag = case wflag of Opt_WarnMissingExportedPatternSynonymSignatures -> "missing-exported-pattern-synonym-signatures" :| [] Opt_WarnForallIdentifier -> "forall-identifier" :| [] Opt_WarnUnicodeBidirectionalFormatCharacters -> "unicode-bidirectional-format-characters" :| [] + Opt_WarnGADTMonoLocalBinds -> "gadt-mono-local-binds" :| [] -- ----------------------------------------------------------------------------- -- Standard sets of warning options @@ -731,7 +733,8 @@ standardWarnings -- see Note [Documenting warning flags] Opt_WarnNonCanonicalMonoidInstances, Opt_WarnOperatorWhitespaceExtConflict, Opt_WarnForallIdentifier, - Opt_WarnUnicodeBidirectionalFormatCharacters + Opt_WarnUnicodeBidirectionalFormatCharacters, + Opt_WarnGADTMonoLocalBinds ] -- | Things you get with -W |