summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2015-10-03 20:05:11 +0200
committerBen Gamari <ben@smart-cactus.org>2015-10-03 20:05:13 +0200
commit0eb8fcd94b29ee9997b386e64203037bdf2aaa04 (patch)
tree401c2c970dbecc8bc1bba52ae186e438712feca0
parent6cde981a8788b225819be28659caddc35b77972d (diff)
downloadhaskell-0eb8fcd94b29ee9997b386e64203037bdf2aaa04.tar.gz
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
-rw-r--r--compiler/deSugar/MatchLit.hs1
-rw-r--r--testsuite/tests/numeric/should_compile/T10929.hs31
-rw-r--r--testsuite/tests/numeric/should_compile/T10929.stderr6
-rw-r--r--testsuite/tests/numeric/should_compile/all.T1
4 files changed, 39 insertions, 0 deletions
diff --git a/compiler/deSugar/MatchLit.hs b/compiler/deSugar/MatchLit.hs
index fddfa80ce1..4e6b8aac53 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/T10929.hs b/testsuite/tests/numeric/should_compile/T10929.hs
new file mode 100644
index 0000000000..47e00719c4
--- /dev/null
+++ b/testsuite/tests/numeric/should_compile/T10929.hs
@@ -0,0 +1,31 @@
+module T10929 where
+
+x1 :: [Integer]
+x1 = [5 .. 3]
+
+x2 :: [Integer]
+x2 = [3 .. 5]
+
+x3 :: [Integer]
+x3 = [5, 3 .. 1]
+
+x4 :: [Integer]
+x4 = [5, (3+0) .. 1]
+
+x5 :: [Integer]
+x5 = [1, 3 .. 5]
+
+x6 :: [Integer]
+x6 = [1, (3+0) .. 5]
+
+x7 :: [Integer]
+x7 = [5, 7 .. 1]
+
+x8 :: [Integer]
+x8 = [5, (7+0) .. 1]
+
+x9 :: [Integer]
+x9 = [3, 1 .. 5]
+
+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 0000000000..8723c42a9a
--- /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 246642f263..ea42aad5d8 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, [''])