summaryrefslogtreecommitdiff
path: root/testsuite/tests/numeric
diff options
context:
space:
mode:
authorSylvain Henry <hsyl20@gmail.com>2018-07-06 11:01:14 -0400
committerBen Gamari <ben@smart-cactus.org>2018-07-06 14:08:37 -0400
commit987b5e7fbacd8afd2c8463c16eac28cd68f43155 (patch)
treed8b8c9875216ebc3d037bbcacb67f48f00e54ad5 /testsuite/tests/numeric
parent379bb201417870482b310cf65505046650fc69b2 (diff)
downloadhaskell-987b5e7fbacd8afd2c8463c16eac28cd68f43155.tar.gz
Fix for built-in Natural literals desugaring
The recent patch "Built-in Natural literals in Core" (https://phabricator.haskell.org/rGHCfe770c211631e7b4c9b0b1e88ef9b6046c6 585ef) introduced a regression when desugaring large numbers. This patch fixes it and adds a regression test. Reviewers: hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15301 Differential Revision: https://phabricator.haskell.org/D4885
Diffstat (limited to 'testsuite/tests/numeric')
-rw-r--r--testsuite/tests/numeric/should_run/T15301.hs7
-rw-r--r--testsuite/tests/numeric/should_run/T15301.stdout1
-rw-r--r--testsuite/tests/numeric/should_run/all.T1
3 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/tests/numeric/should_run/T15301.hs b/testsuite/tests/numeric/should_run/T15301.hs
new file mode 100644
index 0000000000..6efbce4334
--- /dev/null
+++ b/testsuite/tests/numeric/should_run/T15301.hs
@@ -0,0 +1,7 @@
+import Numeric
+import GHC.Natural
+
+main = do
+ -- test that GHC correctly compiles big Natural literals
+ let x = 0xffffffffffffffffffffffff :: Natural
+ print (showHex x "" == "ffffffffffffffffffffffff")
diff --git a/testsuite/tests/numeric/should_run/T15301.stdout b/testsuite/tests/numeric/should_run/T15301.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/numeric/should_run/T15301.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T
index 691fc26f7a..140fa6c50b 100644
--- a/testsuite/tests/numeric/should_run/all.T
+++ b/testsuite/tests/numeric/should_run/all.T
@@ -65,3 +65,4 @@ test('T10011', normal, compile_and_run, [''])
test('T10962', omit_ways(['ghci']), compile_and_run, ['-O2'])
test('T11702', extra_ways(['optasm']), compile_and_run, [''])
test('T12136', normal, compile_and_run, [''])
+test('T15301', normal, compile_and_run, ['-O2'])