diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/numeric/should_compile/T19641.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_compile/T19641.stderr | 32 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_compile/all.T | 1 |
3 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/tests/numeric/should_compile/T19641.hs b/testsuite/tests/numeric/should_compile/T19641.hs new file mode 100644 index 0000000000..826472d7a3 --- /dev/null +++ b/testsuite/tests/numeric/should_compile/T19641.hs @@ -0,0 +1,11 @@ +module Test where + +import Data.Bits +import GHC.Num.Integer +import GHC.Num.Natural + +integer_to_int :: Integer -> Maybe Int +integer_to_int = toIntegralSized + +natural_to_word :: Natural -> Maybe Word +natural_to_word = toIntegralSized diff --git a/testsuite/tests/numeric/should_compile/T19641.stderr b/testsuite/tests/numeric/should_compile/T19641.stderr new file mode 100644 index 0000000000..b79d0217ee --- /dev/null +++ b/testsuite/tests/numeric/should_compile/T19641.stderr @@ -0,0 +1,32 @@ + +==================== Tidy Core ==================== +Result size of Tidy Core + = {terms: 22, types: 20, coercions: 0, joins: 0/0} + +natural_to_word + = \ x -> + case x of { + NS x1 -> Just (W# x1); + NB ds -> Nothing + } + +integer_to_int + = \ x -> + case x of { + IS ipv -> Just (I# ipv); + IP x1 -> Nothing; + IN ds -> Nothing + } + + +------ Local rules for imported ids -------- +"SPEC/Test toIntegralSized @Integer @Int" + forall $dIntegral $dIntegral1 $dBits $dBits1. + toIntegralSized $dIntegral $dIntegral1 $dBits $dBits1 + = integer_to_int +"SPEC/Test toIntegralSized @Natural @Word" + forall $dIntegral $dIntegral1 $dBits $dBits1. + toIntegralSized $dIntegral $dIntegral1 $dBits $dBits1 + = natural_to_word + + diff --git a/testsuite/tests/numeric/should_compile/all.T b/testsuite/tests/numeric/should_compile/all.T index 087eb7b358..4bcccaa521 100644 --- a/testsuite/tests/numeric/should_compile/all.T +++ b/testsuite/tests/numeric/should_compile/all.T @@ -17,3 +17,4 @@ test('T20374', normal, compile, ['-ddump-simpl -O -dsuppress-all -dno-typeable-b test('T19769', normal, compile, ['-ddump-simpl -O -dsuppress-all -dno-typeable-binds -dsuppress-uniques']) test('T20347', normal, compile, ['-ddump-simpl -O -dsuppress-all -dno-typeable-binds -dsuppress-uniques']) test('T20448', normal, compile, ['-ddump-simpl -O -dsuppress-all -dno-typeable-binds -dsuppress-uniques']) +test('T19641', normal, compile, ['-ddump-simpl -O -dsuppress-all -dno-typeable-binds -dsuppress-uniques']) |