summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2018-10-12 11:15:26 -0400
committerBen Gamari <ben@smart-cactus.org>2018-10-12 11:51:46 -0400
commit5b2388b2cb657771c3c578eaf552b300b79f8260 (patch)
tree4ceb57f268be39dbec227413666a5f7601f9fdb0
parent05b2587b00d0a69ae98b2c4976b85cc3e33a7b49 (diff)
downloadhaskell-5b2388b2cb657771c3c578eaf552b300b79f8260.tar.gz
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
-rw-r--r--compiler/main/DynFlags.hs1
-rw-r--r--compiler/parser/RdrHsSyn.hs3
-rw-r--r--docs/users_guide/8.8.1-notes.rst2
-rw-r--r--docs/users_guide/using-warnings.rst4
-rw-r--r--testsuite/tests/wcompat-warnings/Template.hs5
-rw-r--r--testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr6
6 files changed, 19 insertions, 2 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index f9ccc25225..2c8f13418e 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 1015319986..1e89d5a459 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 a27aee721e..d3da37e9eb 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 dba30dbf1e..aeabbe9713 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 e3423c8b9f..03f9a4957e 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 5c2d9c5428..3c3e73ddf6 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.