summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/simplCore/should_compile/Makefile5
-rw-r--r--testsuite/tests/simplCore/should_compile/T17901.hs21
-rw-r--r--testsuite/tests/simplCore/should_compile/T17901.stdout16
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T3
4 files changed, 45 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile
index b40c02175b..396c375110 100644
--- a/testsuite/tests/simplCore/should_compile/Makefile
+++ b/testsuite/tests/simplCore/should_compile/Makefile
@@ -266,3 +266,8 @@ T15631:
T17140:
$(RM) -f T17140*.hi T17140*.o
'$(TEST_HC)' $(TEST_HC_OPTS) --make -O T17140 T17140a -v0
+
+T17901:
+ $(RM) -f T17901.o T17901.hi
+ '$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl -dsuppress-uniques T17901.hs | grep 'wombat'
+ # All three functions should get their case alternatives combined
diff --git a/testsuite/tests/simplCore/should_compile/T17901.hs b/testsuite/tests/simplCore/should_compile/T17901.hs
new file mode 100644
index 0000000000..b60c1b6e18
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T17901.hs
@@ -0,0 +1,21 @@
+module T17901 where
+
+data T = A | B | C
+
+f1 wombat1 x = case x of
+ A -> wombat1 A
+ B -> wombat1 B
+ C -> wombat1 C
+
+data S = SA Int | SB
+
+f2 wombat2 x = case x of
+ SA _ -> wombat2 x
+ SB -> wombat2 x
+
+data W = WB | WA Int
+
+f3 wombat3 x = case x of
+ WA _ -> wombat3 x
+ WB -> wombat3 x
+
diff --git a/testsuite/tests/simplCore/should_compile/T17901.stdout b/testsuite/tests/simplCore/should_compile/T17901.stdout
new file mode 100644
index 0000000000..406e81ef5f
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T17901.stdout
@@ -0,0 +1,16 @@
+ (wombat1 [Occ=Once*!] :: T -> p)
+ A -> wombat1 T17901.A;
+ B -> wombat1 T17901.B;
+ C -> wombat1 T17901.C
+ = \ (@p) (wombat1 :: T -> p) (x :: T) ->
+ case x of wild { __DEFAULT -> wombat1 wild }
+ (wombat2 [Occ=Once*!] :: S -> p)
+ SA _ [Occ=Dead] -> wombat2 wild;
+ SB -> wombat2 T17901.SB
+ = \ (@p) (wombat2 :: S -> p) (x :: S) ->
+ case x of wild { __DEFAULT -> wombat2 wild }
+ (wombat3 [Occ=Once*!] :: W -> p)
+ WB -> wombat3 T17901.WB;
+ WA _ [Occ=Dead] -> wombat3 wild
+ = \ (@p) (wombat3 :: W -> p) (x :: W) ->
+ case x of wild { __DEFAULT -> wombat3 wild }
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 31b7989b43..ed89a35690 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -316,3 +316,6 @@ test('T17590', normal, compile, ['-dcore-lint -O2'])
test('T17722', normal, multimod_compile, ['T17722B', '-dcore-lint -O2 -v0'])
test('T17724', normal, compile, ['-dcore-lint -O2'])
test('T17787', [ grep_errmsg(r'foo') ], compile, ['-ddump-simpl -dsuppress-uniques'])
+test('T17901',
+ normal,
+ makefile_test, ['T17901'])