[commit: ghc] master: Enable `Enumeration is empty` warnings for `Integer` (0eb8fcd)
git at git.haskell.org
git at git.haskell.org
Sat Oct 3 18:44:58 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/0eb8fcd94b29ee9997b386e64203037bdf2aaa04/ghc
>---------------------------------------------------------------
commit 0eb8fcd94b29ee9997b386e64203037bdf2aaa04
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Sat Oct 3 20:05:11 2015 +0200
Enable `Enumeration is empty` warnings for `Integer`
This warning was implemented via
abb3a9faa88fad3562ac41a148dd683765f47565 for addressing #7881. The
bounded H2010 integral types were handled, but the `Integer` type was
missed for the enumeration warning.
Fixes #10929
Test Plan: reused T7881 testcase
Reviewers: thomie, bgamari, austin
Reviewed By: thomie, bgamari, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1305
GHC Trac Issues: #10929
>---------------------------------------------------------------
0eb8fcd94b29ee9997b386e64203037bdf2aaa04
compiler/deSugar/MatchLit.hs | 1 +
.../numeric/should_compile/{T7881.hs => T10929.hs} | 25 ++++++++++------------
.../tests/numeric/should_compile/T10929.stderr | 6 ++++++
testsuite/tests/numeric/should_compile/all.T | 1 +
4 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/compiler/deSugar/MatchLit.hs b/compiler/deSugar/MatchLit.hs
index fddfa80..4e6b8aa 100644
--- a/compiler/deSugar/MatchLit.hs
+++ b/compiler/deSugar/MatchLit.hs
@@ -228,6 +228,7 @@ warnAboutEmptyEnumerations dflags fromExpr mThnExpr toExpr
else if tc == word16TyConName then check (undefined :: Word16)
else if tc == word32TyConName then check (undefined :: Word32)
else if tc == word64TyConName then check (undefined :: Word64)
+ else if tc == integerTyConName then check (undefined :: Integer)
else return ()
| otherwise = return ()
diff --git a/testsuite/tests/numeric/should_compile/T7881.hs b/testsuite/tests/numeric/should_compile/T10929.hs
similarity index 51%
copy from testsuite/tests/numeric/should_compile/T7881.hs
copy to testsuite/tests/numeric/should_compile/T10929.hs
index 73d8452..47e0071 100644
--- a/testsuite/tests/numeric/should_compile/T7881.hs
+++ b/testsuite/tests/numeric/should_compile/T10929.hs
@@ -1,34 +1,31 @@
+module T10929 where
-module T7881 where
-
-import Data.Int
-
-x1 :: [Int8]
+x1 :: [Integer]
x1 = [5 .. 3]
-x2 :: [Int8]
+x2 :: [Integer]
x2 = [3 .. 5]
-x3 :: [Int8]
+x3 :: [Integer]
x3 = [5, 3 .. 1]
-x4 :: [Int8]
+x4 :: [Integer]
x4 = [5, (3+0) .. 1]
-x5 :: [Int8]
+x5 :: [Integer]
x5 = [1, 3 .. 5]
-x6 :: [Int8]
+x6 :: [Integer]
x6 = [1, (3+0) .. 5]
-x7 :: [Int8]
+x7 :: [Integer]
x7 = [5, 7 .. 1]
-x8 :: [Int8]
+x8 :: [Integer]
x8 = [5, (7+0) .. 1]
-x9 :: [Int8]
+x9 :: [Integer]
x9 = [3, 1 .. 5]
-x10 :: [Int8]
+x10 :: [Integer]
x10 = [3, (1+0) .. 5]
diff --git a/testsuite/tests/numeric/should_compile/T10929.stderr b/testsuite/tests/numeric/should_compile/T10929.stderr
new file mode 100644
index 0000000..8723c42
--- /dev/null
+++ b/testsuite/tests/numeric/should_compile/T10929.stderr
@@ -0,0 +1,6 @@
+
+T10929.hs:4:6: warning: Enumeration is empty
+
+T10929.hs:22:6: warning: Enumeration is empty
+
+T10929.hs:28:6: warning: Enumeration is empty
diff --git a/testsuite/tests/numeric/should_compile/all.T b/testsuite/tests/numeric/should_compile/all.T
index 246642f..ea42aad 100644
--- a/testsuite/tests/numeric/should_compile/all.T
+++ b/testsuite/tests/numeric/should_compile/all.T
@@ -2,3 +2,4 @@ test('T7116', normal, run_command, ['$MAKE -s --no-print-directory T7116'])
test('T7895', normal, compile, [''])
test('T7881', normal, compile, [''])
test('T8542', normal, compile, [''])
+test('T10929', normal, compile, [''])
More information about the ghc-commits
mailing list