[commit: ghc] master: DynFlags Remove -fwarn-context-quantification flag (ddde542)

git at git.haskell.org git at git.haskell.org
Tue Dec 15 00:37:54 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ddde542dbcb088e0a10aa3cdc3e0aef0a1c4a9b7/ghc

>---------------------------------------------------------------

commit ddde542dbcb088e0a10aa3cdc3e0aef0a1c4a9b7
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Dec 15 01:01:39 2015 +0100

    DynFlags Remove -fwarn-context-quantification flag
    
    As mentioned in #4426 these warnings are now errors since the Great
    Wildcards Refactor of 2015 (1e041b7382b6aa329e4ad9625439f811e0f27232).
    I've opened #11221 to ensure we remove the last traces of the option in
    8.2.
    
    Test Plan: validate
    
    Reviewers: austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1615
    
    GHC Trac Issues: #4426


>---------------------------------------------------------------

ddde542dbcb088e0a10aa3cdc3e0aef0a1c4a9b7
 compiler/main/DynFlags.hs                          |  6 ++---
 compiler/rename/RnTypes.hs                         |  4 ++--
 docs/users_guide/glasgow_exts.rst                  |  4 ++--
 docs/users_guide/using-warnings.rst                | 26 ++--------------------
 testsuite/tests/rename/should_compile/T4426.hs     |  1 -
 testsuite/tests/rename/should_compile/T4426.stderr | 18 +++++++--------
 6 files changed, 18 insertions(+), 41 deletions(-)

diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 63cfe03..b306253 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -504,7 +504,7 @@ data WarningFlag =
    | Opt_WarnUnusedPatternBinds
    | Opt_WarnUnusedImports
    | Opt_WarnUnusedMatches
-   | Opt_WarnContextQuantification
+   | Opt_WarnContextQuantification    -- remove in 8.2
    | Opt_WarnWarningsDeprecations
    | Opt_WarnDeprecatedFlags
    | Opt_WarnAMP -- Introduced in GHC 7.8, obsolete since 7.10
@@ -2904,7 +2904,8 @@ fWarningFlags = [
   flagSpec "warn-dodgy-foreign-imports"       Opt_WarnDodgyForeignImports,
   flagSpec "warn-dodgy-imports"               Opt_WarnDodgyImports,
   flagSpec "warn-empty-enumerations"          Opt_WarnEmptyEnumerations,
-  flagSpec "warn-context-quantification"      Opt_WarnContextQuantification,
+  flagSpec' "warn-context-quantification"      Opt_WarnContextQuantification
+    (\_ -> deprecate "it is subsumed by an error message that cannot be disabled"),
   flagSpec' "warn-duplicate-constraints"      Opt_WarnDuplicateConstraints
     (\_ -> deprecate "it is subsumed by -fwarn-redundant-constraints"),
   flagSpec "warn-redundant-constraints"       Opt_WarnRedundantConstraints,
@@ -3473,7 +3474,6 @@ standardWarnings -- see Note [Documenting warning flags]
         Opt_WarnInlineRuleShadowing,
         Opt_WarnAlternativeLayoutRuleTransitional,
         Opt_WarnUnsupportedLlvmVersion,
-        Opt_WarnContextQuantification,
         Opt_WarnTabs
       ]
 
diff --git a/compiler/rename/RnTypes.hs b/compiler/rename/RnTypes.hs
index fef7b67..4f7c291 100644
--- a/compiler/rename/RnTypes.hs
+++ b/compiler/rename/RnTypes.hs
@@ -264,8 +264,8 @@ f :: forall a. a -> b         is an error
 f :: forall a. () => a -> b   is an error
 f :: forall a. a -> (() => b) binds "a" and "b"
 
-The -fwarn-context-quantification flag warns about
-this situation. See rnHsTyKi for case HsForAllTy Qualified.
+This situation is now considered to be an error. See rnHsTyKi for case
+HsForAllTy Qualified.
 
 Note [Dealing with *]
 ~~~~~~~~~~~~~~~~~~~~~
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst
index 3c98dc7..ebe1f75 100644
--- a/docs/users_guide/glasgow_exts.rst
+++ b/docs/users_guide/glasgow_exts.rst
@@ -8379,8 +8379,8 @@ example:
 
 As of GHC 7.10, this is deprecated. The
 ``-fwarn-context-quantification`` flag detects this situation and issues
-a warning. In GHC 7.12, declarations such as ``MkSwizzle'`` will cause
-an out-of-scope error.
+a warning. In GHC 8.0 this flag was deprecated and declarations such as
+``MkSwizzle'`` will cause an out-of-scope error.
 
 As for type signatures, implicit quantification happens for
 non-overloaded types too. So if you write this:
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 9b98686..699c8fd 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -19,9 +19,8 @@ generally likely to indicate bugs in your program. These are:
 ``-fwarn-missing-methods``, ``-fwarn-wrong-do-bind``,
 ``-fwarn-unsupported-calling-conventions``,
 ``-fwarn-dodgy-foreign-imports``, ``-fwarn-inline-rule-shadowing``,
-``-fwarn-unsupported-llvm-version``, ``-fwarn-context-quantification``,
-and ``-fwarn-tabs``. The following flags are simple ways to select
-standard “packages” of warnings:
+``-fwarn-unsupported-llvm-version`` and ``-fwarn-tabs``. The following flags are
+simple ways to select standard “packages” of warnings:
 
 ``-W``
     .. index::
@@ -894,27 +893,6 @@ command line.
 
         do { mapM_ popInt xs ; return 10 }
 
-``-fwarn-context-quantification``
-    .. index::
-       single: -fwarn-context-quantification
-       single: implicit context quantification, warning
-       single: context, implicit quantification
-
-    Report if a variable is quantified only due to its presence in a
-    context (see :ref:`universal-quantification`). For example,
-
-    ::
-
-        type T a = Monad m => a -> f a
-
-    It is recommended to write this polymorphic type as
-
-    ::
-
-        type T a = forall m. Monad m => a -> f a
-
-    instead.
-
 ``-fwarn-wrong-do-bind``
     .. index::
        single: -fwarn-wrong-do-bind
diff --git a/testsuite/tests/rename/should_compile/T4426.hs b/testsuite/tests/rename/should_compile/T4426.hs
index 610f670..49e5875 100644
--- a/testsuite/tests/rename/should_compile/T4426.hs
+++ b/testsuite/tests/rename/should_compile/T4426.hs
@@ -1,5 +1,4 @@
 {-# LANGUAGE RankNTypes #-}
-{- # OPTIONS_GHC -fwarn-context-quantification #-}
 
 module T4426 where
 
diff --git a/testsuite/tests/rename/should_compile/T4426.stderr b/testsuite/tests/rename/should_compile/T4426.stderr
index f731f35..0d0b706 100644
--- a/testsuite/tests/rename/should_compile/T4426.stderr
+++ b/testsuite/tests/rename/should_compile/T4426.stderr
@@ -1,18 +1,18 @@
 
-T4426.hs:11:18: error: Not in scope: type variable ‘m’
+T4426.hs:10:18: error: Not in scope: type variable ‘m’
 
-T4426.hs:11:28: error: Not in scope: type variable ‘m’
+T4426.hs:10:28: error: Not in scope: type variable ‘m’
 
-T4426.hs:13:18: error: Not in scope: type variable ‘b’
+T4426.hs:12:18: error: Not in scope: type variable ‘b’
 
-T4426.hs:13:28: error: Not in scope: type variable ‘b’
+T4426.hs:12:28: error: Not in scope: type variable ‘b’
 
-T4426.hs:15:24: error: Not in scope: type variable ‘b’
+T4426.hs:14:24: error: Not in scope: type variable ‘b’
 
-T4426.hs:15:34: error: Not in scope: type variable ‘b’
+T4426.hs:14:34: error: Not in scope: type variable ‘b’
 
-T4426.hs:15:39: error: Not in scope: type variable ‘c’
+T4426.hs:14:39: error: Not in scope: type variable ‘c’
 
-T4426.hs:17:23: error: Not in scope: type variable ‘m’
+T4426.hs:16:23: error: Not in scope: type variable ‘m’
 
-T4426.hs:17:28: error: Not in scope: type variable ‘m’
+T4426.hs:16:28: error: Not in scope: type variable ‘m’



More information about the ghc-commits mailing list