diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-04-12 12:38:45 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-04-14 19:42:53 -0400 |
commit | cc1ba576d26b90c0c01aa43e7100c94ee3a287ad (patch) | |
tree | 3271e7d0fc6d614def8a06347c884d9bbec0caac /testsuite | |
parent | 5f1722994dc29a86f5495ebafb15475a46b0532c (diff) | |
download | haskell-cc1ba576d26b90c0c01aa43e7100c94ee3a287ad.tar.gz |
Fix some negation issues when creating FractionalLit
There were two different issues:
1. integralFractionalLit needed to be passed an already negated value. (T19680)
2. negateFractionalLit did not actually negate the argument, only
flipped the negation flag. (T19680A)
Fixes #19680
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/deSugar/should_run/T19680.hs | 9 | ||||
-rw-r--r-- | testsuite/tests/deSugar/should_run/T19680.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/deSugar/should_run/T19680A.hs | 10 | ||||
-rw-r--r-- | testsuite/tests/deSugar/should_run/T19680A.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/deSugar/should_run/all.T | 2 |
5 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/deSugar/should_run/T19680.hs b/testsuite/tests/deSugar/should_run/T19680.hs new file mode 100644 index 0000000000..881f10dde3 --- /dev/null +++ b/testsuite/tests/deSugar/should_run/T19680.hs @@ -0,0 +1,9 @@ +module Main where + +main :: IO () +main = do + let x = -1 :: Integer + print $ case x of + 1 -> "1" + -1 -> "-1" + _ -> "other" diff --git a/testsuite/tests/deSugar/should_run/T19680.stdout b/testsuite/tests/deSugar/should_run/T19680.stdout new file mode 100644 index 0000000000..5a03a99a88 --- /dev/null +++ b/testsuite/tests/deSugar/should_run/T19680.stdout @@ -0,0 +1 @@ +"-1" diff --git a/testsuite/tests/deSugar/should_run/T19680A.hs b/testsuite/tests/deSugar/should_run/T19680A.hs new file mode 100644 index 0000000000..45d2e86adf --- /dev/null +++ b/testsuite/tests/deSugar/should_run/T19680A.hs @@ -0,0 +1,10 @@ +module Main where + +main :: IO () +main = do + let x = -1e3 :: Rational + print $ case x of + 1e3 -> "1" + -1e3 -> "-1" + _ -> "other" + diff --git a/testsuite/tests/deSugar/should_run/T19680A.stdout b/testsuite/tests/deSugar/should_run/T19680A.stdout new file mode 100644 index 0000000000..5a03a99a88 --- /dev/null +++ b/testsuite/tests/deSugar/should_run/T19680A.stdout @@ -0,0 +1 @@ +"-1" diff --git a/testsuite/tests/deSugar/should_run/all.T b/testsuite/tests/deSugar/should_run/all.T index 9d43f94b40..c9ef02c074 100644 --- a/testsuite/tests/deSugar/should_run/all.T +++ b/testsuite/tests/deSugar/should_run/all.T @@ -71,3 +71,5 @@ test('T18172', [], ghci_script, ['T18172.script']) test('DsDoExprFailMsg', exit_code(1), compile_and_run, ['']) test('DsMonadCompFailMsg', exit_code(1), compile_and_run, ['']) test('T19289', normal, compile_and_run, ['']) +test('T19680', normal, compile_and_run, ['']) +test('T19680A', normal, compile_and_run, ['']) |