diff options
author | Nolan <nolane16@gmail.com> | 2017-05-08 17:46:22 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-05-08 17:46:24 -0400 |
commit | 0279b745c29213c479b61f864ca5d3d2ae76ac77 (patch) | |
tree | 6f5fb39ddcdb142f017e9196ddc480971eb661ae /testsuite/tests/parser | |
parent | dc3b4af6d0c38ced4f0becf575474a1c1b08f794 (diff) | |
download | haskell-0279b745c29213c479b61f864ca5d3d2ae76ac77.tar.gz |
Make XNegativeLiterals treat -0.0 as negative 0
Reviewers: austin, goldfire, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, mpickering
GHC Trac Issues: #13211
Differential Revision: https://phabricator.haskell.org/D3543
Diffstat (limited to 'testsuite/tests/parser')
-rw-r--r-- | testsuite/tests/parser/should_run/NegativeZero.hs | 25 | ||||
-rw-r--r-- | testsuite/tests/parser/should_run/NegativeZero.stdout | 8 | ||||
-rw-r--r-- | testsuite/tests/parser/should_run/all.T | 1 |
3 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_run/NegativeZero.hs b/testsuite/tests/parser/should_run/NegativeZero.hs new file mode 100644 index 0000000000..36e483bd37 --- /dev/null +++ b/testsuite/tests/parser/should_run/NegativeZero.hs @@ -0,0 +1,25 @@ +-- | Test for @NegativeLiterals@ extension (see GHC #13211) + +{-# LANGUAGE NegativeLiterals #-} + +floatZero0 = 0 :: Float +floatZero1 = 0.0 :: Float + +floatNegZero0 = -0 :: Float +floatNegZero1 = -0.0 :: Float + +doubleZero0 = 0 :: Double +doubleZero1 = 0.0 :: Double + +doubleNegZero0 = -0 :: Double +doubleNegZero1 = -0.0 :: Double + +main = do + print (isNegativeZero floatZero0) + print (isNegativeZero floatZero1) + print (isNegativeZero floatNegZero0) + print (isNegativeZero floatNegZero1) + print (isNegativeZero doubleZero0) + print (isNegativeZero doubleZero1) + print (isNegativeZero doubleNegZero0) + print (isNegativeZero doubleNegZero1) diff --git a/testsuite/tests/parser/should_run/NegativeZero.stdout b/testsuite/tests/parser/should_run/NegativeZero.stdout new file mode 100644 index 0000000000..9dc212300a --- /dev/null +++ b/testsuite/tests/parser/should_run/NegativeZero.stdout @@ -0,0 +1,8 @@ +False +False +True +True +False +False +True +True diff --git a/testsuite/tests/parser/should_run/all.T b/testsuite/tests/parser/should_run/all.T index bb5e4fde39..31dea7f5b7 100644 --- a/testsuite/tests/parser/should_run/all.T +++ b/testsuite/tests/parser/should_run/all.T @@ -10,3 +10,4 @@ test('BinaryLiterals0', normal, compile_and_run, ['']) test('BinaryLiterals1', [], compile_and_run, ['']) test('BinaryLiterals2', [], compile_and_run, ['']) test('T10807', normal, compile_and_run, ['']) +test('NegativeZero', normal, compile_and_run, ['']) |