summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-01-05 11:26:26 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-09 21:24:06 -0500
commit2754419673eabea772f27e9ad9275ef6acaddae3 (patch)
treeb7dd6e2f0f3319255536c2d1f2f1eec7cc47a8a7 /testsuite/tests/lib
parent9163b3f104cfe9b9da235f3bf4427d0579f8642e (diff)
downloadhaskell-2754419673eabea772f27e9ad9275ef6acaddae3.tar.gz
Natural: fix left shift of 0 (fix #19170)
Diffstat (limited to 'testsuite/tests/lib')
-rw-r--r--testsuite/tests/lib/integer/T19170.hs11
-rw-r--r--testsuite/tests/lib/integer/T19170.stdout3
-rw-r--r--testsuite/tests/lib/integer/all.T1
3 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/lib/integer/T19170.hs b/testsuite/tests/lib/integer/T19170.hs
new file mode 100644
index 0000000000..0221c8f6bc
--- /dev/null
+++ b/testsuite/tests/lib/integer/T19170.hs
@@ -0,0 +1,11 @@
+module Main where
+
+import Data.Bits
+import GHC.Natural
+import GHC.Num.Natural
+
+main :: IO ()
+main = do
+ print $ (shiftL 0 65 :: Natural)
+ print $ naturalCheck (shiftL 0 65 :: Natural)
+ print $ shiftL 0 65 == (0 :: Natural)
diff --git a/testsuite/tests/lib/integer/T19170.stdout b/testsuite/tests/lib/integer/T19170.stdout
new file mode 100644
index 0000000000..e5b81d9189
--- /dev/null
+++ b/testsuite/tests/lib/integer/T19170.stdout
@@ -0,0 +1,3 @@
+0
+True
+True
diff --git a/testsuite/tests/lib/integer/all.T b/testsuite/tests/lib/integer/all.T
index 3f45423730..f279be2f81 100644
--- a/testsuite/tests/lib/integer/all.T
+++ b/testsuite/tests/lib/integer/all.T
@@ -12,6 +12,7 @@ test('integerGcdExt', [], compile_and_run, [''])
test('integerRecipMod', [], compile_and_run, [''])
test('bignumMatch', [], compile, [''])
test('T18813', [], compile_and_run, [''])
+test('T19170', [], compile_and_run, [''])
# skip ghci as it doesn't support unboxed tuples
test('integerImportExport', [omit_ways(['ghci'])], compile_and_run, [''])