From 12970bfc8cda19cab8cc49f723b44d514bb40a85 Mon Sep 17 00:00:00 2001 From: Krzysztof Gogolewski Date: Thu, 17 Jun 2021 09:58:38 +0200 Subject: Deprecate -Wmissing-monadfail-instances (#17875) Also document deprecation of Wnoncanonical-monadfail-instances and -Wimplicit-kind-vars --- compiler/GHC/Driver/Session.hs | 3 +- docs/users_guide/using-warnings.rst | 64 +++++++++----------------- testsuite/tests/rebindable/rebindable2.hs | 1 - testsuite/tests/rebindable/rebindable3.hs | 1 - testsuite/tests/rebindable/rebindable4.hs | 1 - testsuite/tests/rebindable/rebindable5.hs | 1 - testsuite/tests/typecheck/should_compile/all.T | 2 +- 7 files changed, 26 insertions(+), 47 deletions(-) diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index aa761325d3..8b760a1b08 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -3172,7 +3172,8 @@ wWarningFlagsDeps = mconcat [ "it is replaced by -Wmissing-local-signatures", warnSpec Opt_WarnMissingLocalSignatures, warnSpec Opt_WarnMissingMethods, - warnSpec Opt_WarnMissingMonadFailInstances, + depWarnSpec Opt_WarnMissingMonadFailInstances + "fail is no longer a method of Monad", warnSpec Opt_WarnSemigroup, warnSpec Opt_WarnMissingSignatures, warnSpec Opt_WarnMissingKindSignatures, diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index dc21cd468f..840c66eef6 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -517,32 +517,18 @@ of ``-W(no-)*``. This option is off by default. .. ghc-flag:: -Wnoncanonical-monadfail-instances - :shortdesc: warn when ``Monad`` or ``MonadFail`` instances have + :shortdesc: *(deprecated)* + warn when ``Monad`` or ``MonadFail`` instances have noncanonical definitions of ``fail``. - See flag description in :ref:`options-sanity` for more details. :type: dynamic :reverse: -Wno-noncanonical-monadfail-instances :category: - Warn if noncanonical ``Monad`` or ``MonadFail`` instances - declarations are detected. - - When this warning is enabled, the following conditions are verified: - - In ``Monad`` instances declarations warn if any of the following - conditions does not hold: - - * If ``fail`` is defined it must be canonical - (i.e. ``fail = Control.Monad.Fail.fail``). - - Moreover, in ``MonadFail`` instance declarations: - - * Warn if ``fail`` is defined backwards - (i.e. ``fail = Control.Monad.fail``). - - See also :ghc-flag:`-Wmissing-monadfail-instances`. - - This option is off by default. + This warning is deprecated. It no longer has any effect since GHC 8.8. + It was used during the transition period of the MonadFail proposal, + to detect when an instance of the ``Monad`` class was not defined + via ``MonadFail``, or when a ``MonadFail`` instance was defined + backwards, using the method in ``Monad``. .. ghc-flag:: -Wnoncanonical-monoid-instances :shortdesc: warn when ``Semigroup`` or ``Monoid`` instances have @@ -571,25 +557,17 @@ of ``-W(no-)*``. :ghc-flag:`-Wcompat` option group. .. ghc-flag:: -Wmissing-monadfail-instances - :shortdesc: Warn when a failable pattern is used in a do-block that does + :shortdesc: *(deprecated)* + Warn when a failable pattern is used in a do-block that does not have a ``MonadFail`` instance. :type: dynamic :reverse: -Wno-missing-monadfail-instances :category: - .. index:: - single: MFP - single: MonadFail Proposal - - Warn when a failable pattern is used in a do-block that does not have a - ``MonadFail`` instance. - - See also :ghc-flag:`-Wnoncanonical-monadfail-instances`. - - Being part of the :ghc-flag:`-Wcompat` option group, this warning is off by - default, but will be switched on in a future GHC release, as part of - the `MonadFail Proposal (MFP) - `__. + This warning is deprecated. It no longer has any effect since GHC 8.8. + It was used during the transition period of the MonadFail proposal, + to warn when a failable pattern is used in a do-block that does not have + a ``MonadFail`` instance. .. ghc-flag:: -Wsemigroup :shortdesc: warn when a ``Monoid`` is not ``Semigroup``, and on non- @@ -836,23 +814,27 @@ of ``-W(no-)*``. ``toInteger``, ``toRational``, ``fromIntegral``, and ``realToFrac``. .. ghc-flag:: -Wimplicit-kind-vars - :shortdesc: warn when kind variables are implicitly quantified over. + :shortdesc: *(deprecated)* warn when kind variables are + implicitly quantified over. :type: dynamic :reverse: -Wno-implicit-kind-vars :category: - .. index:: - single: implicit prelude, warning - - Have the compiler warn if a kind variable is not explicitly quantified + This warning is deprecated. It no longer has any effect since GHC 8.10. + It was used to detect if a kind variable is not explicitly quantified over. For instance, the following would produce a warning: :: f :: forall (a :: k). Proxy a - This can be fixed by explicitly quantifying over ``k``: :: + This is now an error and can be fixed by explicitly quantifying + over ``k``: :: f :: forall k (a :: k). Proxy a + or :: + + f :: forall {k} (a :: k). Proxy a + .. ghc-flag:: -Wimplicit-lift :shortdesc: warn about implicit ``lift`` in Template Haskell quotes :type: dynamic diff --git a/testsuite/tests/rebindable/rebindable2.hs b/testsuite/tests/rebindable/rebindable2.hs index 3858d2b9f3..5729c4ef34 100644 --- a/testsuite/tests/rebindable/rebindable2.hs +++ b/testsuite/tests/rebindable/rebindable2.hs @@ -1,5 +1,4 @@ {-# LANGUAGE RebindableSyntax, NPlusKPatterns #-} -{-# OPTIONS -Wno-error=missing-monadfail-instances #-} module Main where { diff --git a/testsuite/tests/rebindable/rebindable3.hs b/testsuite/tests/rebindable/rebindable3.hs index c5fd3b255b..0434c1d0fd 100644 --- a/testsuite/tests/rebindable/rebindable3.hs +++ b/testsuite/tests/rebindable/rebindable3.hs @@ -1,5 +1,4 @@ {-# LANGUAGE RebindableSyntax, NPlusKPatterns #-} -{-# OPTIONS -Wno-error=missing-monadfail-instances #-} module Main where { diff --git a/testsuite/tests/rebindable/rebindable4.hs b/testsuite/tests/rebindable/rebindable4.hs index 26adc87e21..f657683a08 100644 --- a/testsuite/tests/rebindable/rebindable4.hs +++ b/testsuite/tests/rebindable/rebindable4.hs @@ -1,5 +1,4 @@ {-# LANGUAGE RebindableSyntax, NPlusKPatterns #-} -{-# OPTIONS -Wno-error=missing-monadfail-instances #-} module Main where { diff --git a/testsuite/tests/rebindable/rebindable5.hs b/testsuite/tests/rebindable/rebindable5.hs index 2ce735b670..3120ea1a90 100644 --- a/testsuite/tests/rebindable/rebindable5.hs +++ b/testsuite/tests/rebindable/rebindable5.hs @@ -1,6 +1,5 @@ {-# LANGUAGE RebindableSyntax, NPlusKPatterns, FlexibleInstances, MultiParamTypeClasses, FunctionalDependencies #-} -{-# OPTIONS -Wno-error=missing-monadfail-instances #-} module Main where { diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 9cd7c732ca..968aeb1aa7 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -663,7 +663,7 @@ test('T15473', normal, compile_fail, ['']) test('T15499', normal, compile, ['']) test('T15586', normal, compile, ['']) test('T15368', normal, compile, ['-fdefer-type-errors']) -test('T15645', normal, compile, ['-Wwarn=missing-monadfail-instances']) +test('T15645', normal, compile, ['']) test('T15646', compile_timeout_multiplier(0.01), # 0.01 may seem tiny (1 is timeout after 300s, so this is 3 seconds), -- cgit v1.2.1