[commit: ghc] master: Include -fwarn-star-is-type in -Wcompat (5b2388b)
git at git.haskell.org
git at git.haskell.org
Fri Oct 12 15:58:05 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/5b2388b2cb657771c3c578eaf552b300b79f8260/ghc
>---------------------------------------------------------------
commit 5b2388b2cb657771c3c578eaf552b300b79f8260
Author: Vladislav Zavialov <vlad.z.4096 at gmail.com>
Date: Fri Oct 12 11:15:26 2018 -0400
Include -fwarn-star-is-type in -Wcompat
According to the deprecation schedule in the accepted proposal,
the first step is to include `-fwarn-star-is-type` in `-Wcompat`.
Test Plan: Validate
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, carter
GHC Trac Issues: #15476
Differential Revision: https://phabricator.haskell.org/D5044
>---------------------------------------------------------------
5b2388b2cb657771c3c578eaf552b300b79f8260
compiler/main/DynFlags.hs | 1 +
compiler/parser/RdrHsSyn.hs | 3 ++-
docs/users_guide/8.8.1-notes.rst | 2 ++
docs/users_guide/using-warnings.rst | 4 ++++
testsuite/tests/wcompat-warnings/Template.hs | 5 ++++-
testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr | 6 ++++++
6 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index f9ccc25..2c8f134 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -4614,6 +4614,7 @@ minusWcompatOpts
, Opt_WarnSemigroup
, Opt_WarnNonCanonicalMonoidInstances
, Opt_WarnImplicitKindVars
+ , Opt_WarnStarIsType
]
enableUnusedBinds :: DynP ()
diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs
index 1015319..1e89d5a 100644
--- a/compiler/parser/RdrHsSyn.hs
+++ b/compiler/parser/RdrHsSyn.hs
@@ -2049,7 +2049,8 @@ warnStarIsType span = addWarning Opt_WarnStarIsType span msg
msg = text "Using" <+> quotes (text "*")
<+> text "(or its Unicode variant) to mean"
<+> quotes (text "Data.Kind.Type")
- $$ text "relies on the StarIsType extension."
+ $$ text "relies on the StarIsType extension, which will become"
+ $$ text "deprecated in the future."
$$ text "Suggested fix: use" <+> quotes (text "Type")
<+> text "from" <+> quotes (text "Data.Kind") <+> text "instead."
diff --git a/docs/users_guide/8.8.1-notes.rst b/docs/users_guide/8.8.1-notes.rst
index a27aee7..d3da37e 100644
--- a/docs/users_guide/8.8.1-notes.rst
+++ b/docs/users_guide/8.8.1-notes.rst
@@ -59,6 +59,8 @@ Compiler
- New :ghc-flag:`-keep-hscpp-files` to keep the output of the CPP pre-processor.
+- The :ghc-flag:`-Wcompat` warning group now includes :ghc-flag:`-Wstar-is-type`.
+
Runtime system
~~~~~~~~~~~~~~
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index dba30db..aeabbe9 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -117,6 +117,7 @@ The following flags are simple ways to select standard "packages" of warnings:
* :ghc-flag:`-Wsemigroup`
* :ghc-flag:`-Wnoncanonical-monoid-instances`
* :ghc-flag:`-Wimplicit-kind-vars`
+ * :ghc-flag:`-Wstar-is-type`
.. ghc-flag:: -Wno-compat
:shortdesc: Disables all warnings enabled by :ghc-flag:`-Wcompat`.
@@ -1194,6 +1195,9 @@ of ``-W(no-)*``.
breaking change takes place. The recommended fix is to replace ``*`` with
``Type`` imported from ``Data.Kind``.
+ 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.
+
.. ghc-flag:: -Wstar-binder
:shortdesc: warn about binding the ``(*)`` type operator despite
:ghc-flag:`-XStarIsType`
diff --git a/testsuite/tests/wcompat-warnings/Template.hs b/testsuite/tests/wcompat-warnings/Template.hs
index e3423c8..03f9a49 100644
--- a/testsuite/tests/wcompat-warnings/Template.hs
+++ b/testsuite/tests/wcompat-warnings/Template.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE NoMonadFailDesugaring #-}
+{-# LANGUAGE NoMonadFailDesugaring, KindSignatures #-}
module WCompatWarningsOnOff where
@@ -21,3 +21,6 @@ instance Monoid S where
S a `mappend` S b = S (a+b)
mempty = S 0
+-- -fwarn-star-is-type
+b :: (Bool :: *)
+b = True
diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr
index 5c2d9c5..3c3e73d 100644
--- a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr
+++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr
@@ -33,3 +33,9 @@ Template.hs:21:3: warning: [-Wnoncanonical-monoid-instances (in -Wcompat)]
Noncanonical ‘mappend’ definition detected
in the instance declaration for ‘Monoid S’.
Define as ‘mappend = (<>)’
+
+Template.hs:25:15: warning: [-Wstar-is-type (in -Wcompat)]
+ Using ‘*’ (or its Unicode variant) to mean ‘Data.Kind.Type’
+ relies on the StarIsType extension, which will become
+ deprecated in the future.
+ Suggested fix: use ‘Type’ from ‘Data.Kind’ instead.
More information about the ghc-commits
mailing list