diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2023-01-14 14:41:39 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-01-18 01:56:22 -0500 |
commit | e9c0537cfbf7b47c64f592f529e402358b66ca7f (patch) | |
tree | a1e9fe1b5dadf437f7b8bf5dada0d11e4c7d8283 | |
parent | ee9b78aa17e1eb81b3c4aa6a5ce324de49530e92 (diff) | |
download | haskell-e9c0537cfbf7b47c64f592f529e402358b66ca7f.tar.gz |
Enable -Wstar-is-type by default (#22759)
Following the plan in GHC Proposal #143 "Remove the * kind syntax",
which states:
In the next release (or 3 years in), enable -fwarn-star-is-type by default.
The "next release" happens to be 9.6.1
I also moved the T21583 test case from should_fail to should_compile,
because the only reason it was failing was -Werror=compat in our test
suite configuration.
-rw-r--r-- | compiler/GHC/Driver/Flags.hs | 3 | ||||
-rw-r--r-- | compiler/GHC/Tc/Errors/Types.hs | 2 | ||||
-rw-r--r-- | docs/users_guide/9.6.1-notes.rst | 2 | ||||
-rw-r--r-- | docs/users_guide/using-warnings.rst | 5 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci024.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci024.stdout-mingw32 | 1 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T21583.hs (renamed from testsuite/tests/typecheck/should_fail/T21583.hs) | 4 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T21583.stderr | 15 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T21583.stderr | 27 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/T22759.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/T22759.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/warnings/should_compile/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/wcompat-warnings/Template.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr | 12 |
16 files changed, 38 insertions, 53 deletions
diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs index 4f656041df..634718ae7e 100644 --- a/compiler/GHC/Driver/Flags.hs +++ b/compiler/GHC/Driver/Flags.hs @@ -822,6 +822,7 @@ standardWarnings -- see Note [Documenting warning flags] Opt_WarnUnrecognisedWarningFlags, Opt_WarnSimplifiableClassConstraints, Opt_WarnStarBinder, + Opt_WarnStarIsType, Opt_WarnInaccessibleCode, Opt_WarnSpaceAfterBang, Opt_WarnNonCanonicalMonadInstances, @@ -863,7 +864,6 @@ minusWallOpts Opt_WarnMissingPatternSynonymSignatures, Opt_WarnUnusedRecordWildcards, Opt_WarnRedundantRecordWildcards, - Opt_WarnStarIsType, Opt_WarnIncompleteUniPatterns, Opt_WarnIncompletePatternsRecUpd ] @@ -881,7 +881,6 @@ minusWcompatOpts :: [WarningFlag] minusWcompatOpts = [ Opt_WarnSemigroup , Opt_WarnNonCanonicalMonoidInstances - , Opt_WarnStarIsType , Opt_WarnCompatUnqualifiedImports , Opt_WarnTypeEqualityOutOfScope ] diff --git a/compiler/GHC/Tc/Errors/Types.hs b/compiler/GHC/Tc/Errors/Types.hs index 65701f9fee..add396957c 100644 --- a/compiler/GHC/Tc/Errors/Types.hs +++ b/compiler/GHC/Tc/Errors/Types.hs @@ -2578,7 +2578,7 @@ data TcRnMessage where testsuite/tests/typecheck/should_compile/tc078 testsuite/tests/typecheck/should_compile/tc161 testsuite/tests/typecheck/should_fail/T5051 - testsuite/tests/typecheck/should_fail/T21583 + testsuite/tests/typecheck/should_compile/T21583 testsuite/tests/backpack/should_compile/bkp47 testsuite/tests/backpack/should_fail/bkpfail25 testsuite/tests/parser/should_compile/T2245 diff --git a/docs/users_guide/9.6.1-notes.rst b/docs/users_guide/9.6.1-notes.rst index 9fd0ca2d75..5105a3ece7 100644 --- a/docs/users_guide/9.6.1-notes.rst +++ b/docs/users_guide/9.6.1-notes.rst @@ -96,6 +96,8 @@ Compiler - The :ghc-flag:`-Woperator-whitespace` warning no longer ignores constructor symbols (operators starting with ``:``). +- The :ghc-flag:`-Wstar-is-type` warning is now enabled by default. + - Added a new warning :ghc-flag:`-Wterm-variable-capture` that helps to make code compatible with the future extension ``RequiredTypeArguments``. diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index c99c51043f..4a6e1ab817 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -60,6 +60,7 @@ To reverse ``-Werror``, which makes all warnings into errors, use ``-Wwarn``. * :ghc-flag:`-Wunrecognised-warning-flags` * :ghc-flag:`-Winaccessible-code` * :ghc-flag:`-Wstar-binder` + * :ghc-flag:`-Wstar-is-type` * :ghc-flag:`-Woperator-whitespace-ext-conflict` * :ghc-flag:`-Wambiguous-fields` * :ghc-flag:`-Wunicode-bidirectional-format-characters` @@ -160,7 +161,6 @@ The following flags are simple ways to select standard "packages" of warnings: * :ghc-flag:`-Wsemigroup` * :ghc-flag:`-Wnoncanonical-monoid-instances` - * :ghc-flag:`-Wstar-is-type` * :ghc-flag:`-Wcompat-unqualified-imports` * :ghc-flag:`-Wtype-equality-out-of-scope` @@ -1505,9 +1505,6 @@ 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 :extension:`StarIsType` diff --git a/testsuite/tests/ghci/scripts/ghci024.stdout b/testsuite/tests/ghci/scripts/ghci024.stdout index c7ddba4f62..ea2b56d35d 100644 --- a/testsuite/tests/ghci/scripts/ghci024.stdout +++ b/testsuite/tests/ghci/scripts/ghci024.stdout @@ -16,7 +16,6 @@ other dynamic, non-language, flag settings: -fprefer-byte-code warning settings: -Wsemigroup - -Wstar-is-type -Wcompat-unqualified-imports -Wtype-equality-out-of-scope ~~~~~~~~~~ Testing :set -a diff --git a/testsuite/tests/ghci/scripts/ghci024.stdout-mingw32 b/testsuite/tests/ghci/scripts/ghci024.stdout-mingw32 index 7dea29c218..e5e54a12b0 100644 --- a/testsuite/tests/ghci/scripts/ghci024.stdout-mingw32 +++ b/testsuite/tests/ghci/scripts/ghci024.stdout-mingw32 @@ -15,7 +15,6 @@ other dynamic, non-language, flag settings: -fprefer-byte-code warning settings: -Wsemigroup - -Wstar-is-type -Wcompat-unqualified-imports -Wtype-equality-out-of-scope ~~~~~~~~~~ Testing :set -a diff --git a/testsuite/tests/typecheck/should_fail/T21583.hs b/testsuite/tests/typecheck/should_compile/T21583.hs index 5b7873dce6..7146e1de03 100644 --- a/testsuite/tests/typecheck/should_fail/T21583.hs +++ b/testsuite/tests/typecheck/should_compile/T21583.hs @@ -5,13 +5,15 @@ {-# LANGUAGE FlexibleContexts #-} module Telomare.Possible where +import Data.Kind (Type) + data PartExprF f = ZeroSF deriving (Eq, Ord, Show, Functor, Foldable, Traversable) newtype EnhancedExpr f = EnhancedExpr {unEnhanceExpr :: SplitFunctor f PartExprF (EnhancedExpr f)} -- deriving (Eq, Show) -type family Base t :: * -> * +type family Base t :: Type -> Type type instance Base (EnhancedExpr f) = SplitFunctor f PartExprF diff --git a/testsuite/tests/typecheck/should_compile/T21583.stderr b/testsuite/tests/typecheck/should_compile/T21583.stderr new file mode 100644 index 0000000000..b05cadf933 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T21583.stderr @@ -0,0 +1,15 @@ + +T21583.hs:58:10: warning: [GHC-06201] [-Wmissing-methods (in -Wdefault)] + • No explicit implementation for + ‘fmap’ + • In the instance declaration for ‘Functor (SplitFunctor g f)’ + +T21583.hs:60:10: warning: [GHC-06201] [-Wmissing-methods (in -Wdefault)] + • No explicit implementation for + either ‘foldMap’ or ‘foldr’ + • In the instance declaration for ‘Foldable (SplitFunctor g f)’ + +T21583.hs:62:10: warning: [GHC-06201] [-Wmissing-methods (in -Wdefault)] + • No explicit implementation for + either ‘traverse’ or ‘sequenceA’ + • In the instance declaration for ‘Traversable (SplitFunctor g f)’ diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 0a1edfa866..fc5ce4936b 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -825,6 +825,7 @@ test('T21328', normal, compile, ['']) test('T21516', normal, compile, ['']) test('T21519', normal, compile, ['']) test('T21519a', normal, compile, ['']) +test('T21583', normal, compile, ['']) test('T2595', normal, compile, ['']) test('T3632', normal, compile, ['']) test('T10808', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_fail/T21583.stderr b/testsuite/tests/typecheck/should_fail/T21583.stderr deleted file mode 100644 index 04aa3d938d..0000000000 --- a/testsuite/tests/typecheck/should_fail/T21583.stderr +++ /dev/null @@ -1,27 +0,0 @@ - -T21583.hs:14:23: error: [GHC-39567] [-Wstar-is-type (in -Wall, -Wcompat), Werror=star-is-type] - 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. - -T21583.hs:14:28: error: [GHC-39567] [-Wstar-is-type (in -Wall, -Wcompat), Werror=star-is-type] - 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. - -T21583.hs:56:10: warning: [GHC-06201] [-Wmissing-methods (in -Wdefault)] - • No explicit implementation for - ‘fmap’ - • In the instance declaration for ‘Functor (SplitFunctor g f)’ - -T21583.hs:58:10: warning: [GHC-06201] [-Wmissing-methods (in -Wdefault)] - • No explicit implementation for - either ‘foldMap’ or ‘foldr’ - • In the instance declaration for ‘Foldable (SplitFunctor g f)’ - -T21583.hs:60:10: warning: [GHC-06201] [-Wmissing-methods (in -Wdefault)] - • No explicit implementation for - either ‘traverse’ or ‘sequenceA’ - • In the instance declaration for ‘Traversable (SplitFunctor g f)’ diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index bfb7b311a0..5224a58aa6 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -660,7 +660,6 @@ test('T20768_fail', normal, compile_fail, ['']) test('T21327', normal, compile_fail, ['']) test('T21338', normal, compile_fail, ['']) test('T21158', normal, compile_fail, ['']) -test('T21583', normal, compile_fail, ['']) test('MissingDefaultMethodBinding', normal, compile_fail, ['']) test('T21447', normal, compile_fail, ['']) test('T21530a', normal, compile_fail, ['']) diff --git a/testsuite/tests/warnings/should_compile/T22759.hs b/testsuite/tests/warnings/should_compile/T22759.hs new file mode 100644 index 0000000000..7834eeeb1e --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T22759.hs @@ -0,0 +1,4 @@ +module T22759 where + +b :: (Bool :: *) +b = True
\ No newline at end of file diff --git a/testsuite/tests/warnings/should_compile/T22759.stderr b/testsuite/tests/warnings/should_compile/T22759.stderr new file mode 100644 index 0000000000..deb0842a47 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T22759.stderr @@ -0,0 +1,6 @@ + +T22759.hs:3:15: warning: [GHC-39567] [-Wstar-is-type (in -Wdefault)] + 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. diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T index 40d1ce12f0..3139a042e2 100644 --- a/testsuite/tests/warnings/should_compile/all.T +++ b/testsuite/tests/warnings/should_compile/all.T @@ -53,3 +53,4 @@ test('DerivingTypeable', normal, compile, ['-Wderiving-typeable']) test('T18862a', normal, compile, ['']) test('T18862b', normal, compile, ['']) test('T20312', normal, compile,['-Wall']) +test('T22759', normal, compile, ['']) diff --git a/testsuite/tests/wcompat-warnings/Template.hs b/testsuite/tests/wcompat-warnings/Template.hs index 798eafc787..2a9a11b0c4 100644 --- a/testsuite/tests/wcompat-warnings/Template.hs +++ b/testsuite/tests/wcompat-warnings/Template.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE KindSignatures #-} - module WCompatWarningsOnOff where import qualified Data.Semigroup as Semi @@ -15,7 +13,3 @@ instance Semi.Semigroup S where 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 a24d18353d..aaf0772b41 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr @@ -1,23 +1,17 @@ -Template.hs:7:1: warning: [-Wsemigroup (in -Wcompat)] +Template.hs:5:1: warning: [-Wsemigroup (in -Wcompat)] Local definition of ‘<>’ clashes with a future Prelude name. This will become an error in a future release. -Template.hs:13:3: warning: [-Wnoncanonical-monoid-instances (in -Wdefault, -Wcompat)] +Template.hs:11:3: warning: [-Wnoncanonical-monoid-instances (in -Wdefault, -Wcompat)] Noncanonical ‘(<>) = mappend’ definition detected in the instance declaration for ‘Semigroup S’. Move definition from ‘mappend’ to ‘(<>)’ See also: https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/semigroup-monoid -Template.hs:16:3: warning: [-Wnoncanonical-monoid-instances (in -Wdefault, -Wcompat)] +Template.hs:14:3: warning: [-Wnoncanonical-monoid-instances (in -Wdefault, -Wcompat)] Noncanonical ‘mappend’ definition detected in the instance declaration for ‘Monoid S’. ‘mappend’ will eventually be removed in favour of ‘(<>)’ Either remove definition for ‘mappend’ (recommended) or define as ‘mappend = (<>)’ See also: https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/semigroup-monoid - -Template.hs:20:15: warning: [GHC-39567] [-Wstar-is-type (in -Wall, -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. |