[commit: ghc] master: Don't suggest deprecated flags in error messages (f3be304)
git at git.haskell.org
git at git.haskell.org
Fri Oct 7 14:20:51 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f3be304abed6407b5ef148d76e4679c88018c780/ghc
>---------------------------------------------------------------
commit f3be304abed6407b5ef148d76e4679c88018c780
Author: Martin Ceresa <ceresa at cifasis-conicet.gov.ar>
Date: Fri Oct 7 13:54:10 2016 +0100
Don't suggest deprecated flags in error messages
When looking up flags, we make sure to lookup the non-deprecated flags first
by ordering the list of flags.
Reviewers: bgamari, austin, mpickering
Reviewed By: mpickering
Subscribers: mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D2541
GHC Trac Issues: #12574
>---------------------------------------------------------------
f3be304abed6407b5ef148d76e4679c88018c780
compiler/main/DynFlags.hs | 10 +++++++++-
testsuite/tests/warnings/should_compile/T11077.stderr | 2 +-
testsuite/tests/warnings/should_compile/T12574.hs | 3 +++
testsuite/tests/warnings/should_compile/T12574.stderr | 4 ++++
testsuite/tests/warnings/should_compile/T2526.stderr | 2 +-
testsuite/tests/warnings/should_compile/all.T | 3 +++
6 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 97a6211..63bb0ef 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -3236,7 +3236,15 @@ flagSpecOf flag = listToMaybe $ filter check wWarningFlags
-- | These @-W\<blah\>@ flags can all be reversed with @-Wno-\<blah\>@
wWarningFlags :: [FlagSpec WarningFlag]
-wWarningFlags = map snd wWarningFlagsDeps
+wWarningFlags = wWarningFlagsDepsCurrent ++ wWarningFlagsDepsDeprecated
+ where
+ deprecatedWFlags = filter (not . isCurr) wWarningFlagsDeps
+ currentWFlags = filter isCurr wWarningFlagsDeps
+ wWarningFlagsDepsCurrent = map snd currentWFlags
+ wWarningFlagsDepsDeprecated = map snd deprecatedWFlags
+
+ isCurr ( Deprecated , _ ) = False
+ isCurr _ = True
wWarningFlagsDeps :: [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps = [
diff --git a/testsuite/tests/warnings/should_compile/T11077.stderr b/testsuite/tests/warnings/should_compile/T11077.stderr
index ba7d4d8..1d68043 100644
--- a/testsuite/tests/warnings/should_compile/T11077.stderr
+++ b/testsuite/tests/warnings/should_compile/T11077.stderr
@@ -1,3 +1,3 @@
-T11077.hs:3:1: warning: [-Wmissing-exported-sigs]
+T11077.hs:3:1: warning: [-Wmissing-exported-signatures]
Top-level binding with no type signature: foo :: a
diff --git a/testsuite/tests/warnings/should_compile/T12574.hs b/testsuite/tests/warnings/should_compile/T12574.hs
new file mode 100644
index 0000000..7f54e7a
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/T12574.hs
@@ -0,0 +1,3 @@
+module T12574 where
+
+id a = a
diff --git a/testsuite/tests/warnings/should_compile/T12574.stderr b/testsuite/tests/warnings/should_compile/T12574.stderr
new file mode 100644
index 0000000..ded8833
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/T12574.stderr
@@ -0,0 +1,4 @@
+
+T12574.hs:3:1: warning: [-Wmissing-local-signatures]
+ Polymorphic local binding with no type signature:
+ T12574.id :: forall t. t -> t
diff --git a/testsuite/tests/warnings/should_compile/T2526.stderr b/testsuite/tests/warnings/should_compile/T2526.stderr
index 07cf8d8..b433f0e 100644
--- a/testsuite/tests/warnings/should_compile/T2526.stderr
+++ b/testsuite/tests/warnings/should_compile/T2526.stderr
@@ -1,3 +1,3 @@
-T2526.hs:4:1: warning: [-Wmissing-exported-sigs]
+T2526.hs:4:1: warning: [-Wmissing-exported-signatures]
Top-level binding with no type signature: foo :: Integer
diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T
index d2c8c1a..ed128fa 100644
--- a/testsuite/tests/warnings/should_compile/all.T
+++ b/testsuite/tests/warnings/should_compile/all.T
@@ -13,6 +13,9 @@ test('T11128', normal, compile, [''])
test('T11128b', normal, compile, [''])
test('PluralS', normal, compile, [''])
+# T12574 Test that suggest current flag over deprecated
+test('T12574',normal, compile, ['-fwarn-missing-local-signatures'])
+
test('DeprU',
extra_clean([
'DeprM.o', 'DeprU.o',
More information about the ghc-commits
mailing list