summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/main/DynFlags.hs3
-rw-r--r--compiler/typecheck/TcDeriv.hs3
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 5bd8cb819f..45a465bd9c 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -920,6 +920,7 @@ data WarningFlag =
| Opt_WarnUnusedPackages -- Since 8.10
| Opt_WarnInferredSafeImports -- Since 8.10
| Opt_WarnMissingSafeHaskellMode -- Since 8.10
+ | Opt_WarnDerivingDefaults
deriving (Eq, Show, Enum)
data Language = Haskell98 | Haskell2010
@@ -4026,6 +4027,7 @@ wWarningFlagsDeps = [
Opt_WarnDeferredOutOfScopeVariables,
flagSpec "deprecations" Opt_WarnWarningsDeprecations,
flagSpec "deprecated-flags" Opt_WarnDeprecatedFlags,
+ flagSpec "deriving-defaults" Opt_WarnDerivingDefaults,
flagSpec "deriving-typeable" Opt_WarnDerivingTypeable,
flagSpec "dodgy-exports" Opt_WarnDodgyExports,
flagSpec "dodgy-foreign-imports" Opt_WarnDodgyForeignImports,
@@ -4824,6 +4826,7 @@ standardWarnings -- see Note [Documenting warning flags]
Opt_WarnPartialTypeSignatures,
Opt_WarnUnrecognisedPragmas,
Opt_WarnDuplicateExports,
+ Opt_WarnDerivingDefaults,
Opt_WarnOverflowedLiterals,
Opt_WarnEmptyEnumerations,
Opt_WarnMissingFields,
diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs
index 0b78b8e2ed..d2b32e7d7d 100644
--- a/compiler/typecheck/TcDeriv.hs
+++ b/compiler/typecheck/TcDeriv.hs
@@ -1756,7 +1756,8 @@ mkNewTypeEqn
-- DeriveAnyClass, but emitting a warning about the choice.
-- See Note [Deriving strategies]
when (newtype_deriving && deriveAnyClass) $
- lift $ addWarnTc NoReason $ sep
+ lift $ whenWOptM Opt_WarnDerivingDefaults $
+ addWarnTc (Reason Opt_WarnDerivingDefaults) $ sep
[ text "Both DeriveAnyClass and"
<+> text "GeneralizedNewtypeDeriving are enabled"
, text "Defaulting to the DeriveAnyClass strategy"