Add a test for T7895 (literal overflow)
authorIan Lynagh <ian@well-typed.com>
Wed, 31 Jul 2013 17:49:59 +0000 (18:49 +0100)
committerIan Lynagh <ian@well-typed.com>
Wed, 31 Jul 2013 19:02:00 +0000 (20:02 +0100)
testsuite/tests/numeric/should_compile/T7895.hs [new file with mode: 0644]
testsuite/tests/numeric/should_compile/T7895.stderr [new file with mode: 0644]
testsuite/tests/numeric/should_compile/all.T

diff --git a/testsuite/tests/numeric/should_compile/T7895.hs b/testsuite/tests/numeric/should_compile/T7895.hs
new file mode 100644 (file)
index 0000000..e5dbfc9
--- /dev/null
@@ -0,0 +1,26 @@
+
+{-# LANGUAGE NegativeLiterals #-}
+
+module T7895 where
+
+import Data.Int
+import Data.Word
+
+v1 :: Word8
+v1 = 300
+
+v2 :: Int8
+v2 = -129
+
+v3 :: Int8
+v3 = -128
+
+v4 :: Int8
+v4 = -127
+
+v5 :: Int8
+v5 = -5
+
+v6 :: Int8
+v6 = 127
+
diff --git a/testsuite/tests/numeric/should_compile/T7895.stderr b/testsuite/tests/numeric/should_compile/T7895.stderr
new file mode 100644 (file)
index 0000000..b72faea
--- /dev/null
@@ -0,0 +1,4 @@
+
+T7895.hs:10:6: Warning: Literal 300 of type Word8 overflows
+
+T7895.hs:13:6: Warning: Literal -129 of type Int8 overflows
index 3e8d4d3..27a9242 100644 (file)
@@ -1 +1,2 @@
 test('T7116', normal, run_command, ['$MAKE -s --no-print-directory T7116'])
+test('T7895', normal, compile, [''])