From 987b5e7fbacd8afd2c8463c16eac28cd68f43155 Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Fri, 6 Jul 2018 11:01:14 -0400 Subject: 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 --- testsuite/tests/numeric/should_run/T15301.hs | 7 +++++++ testsuite/tests/numeric/should_run/T15301.stdout | 1 + testsuite/tests/numeric/should_run/all.T | 1 + 3 files changed, 9 insertions(+) create mode 100644 testsuite/tests/numeric/should_run/T15301.hs create mode 100644 testsuite/tests/numeric/should_run/T15301.stdout (limited to 'testsuite/tests') 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']) -- cgit v1.2.1