summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlp Mestanogullari <alpmestan@gmail.com>2019-09-10 10:57:26 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-09-13 03:11:50 -0400
commite3a7592bf81a6fc5854c3605d50cb53282e4bfbf (patch)
tree9f085f723f5e1a9fadf54c9060f96ac69e9e7e86
parent47b126608938bb849565df70a404c0f3b3d61c65 (diff)
downloadhaskell-e3a7592bf81a6fc5854c3605d50cb53282e4bfbf.tar.gz
Add a test to make sure we don't regress on #17140 in the future
-rw-r--r--testsuite/tests/simplCore/should_compile/Makefile4
-rw-r--r--testsuite/tests/simplCore/should_compile/T17140.hs8
-rw-r--r--testsuite/tests/simplCore/should_compile/T17140.hs-boot5
-rw-r--r--testsuite/tests/simplCore/should_compile/T17140a.hs8
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T4
5 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile
index 4b71bf3661..c27458c46c 100644
--- a/testsuite/tests/simplCore/should_compile/Makefile
+++ b/testsuite/tests/simplCore/should_compile/Makefile
@@ -257,3 +257,7 @@ T15631:
$(RM) -f T15631.o T15631.hi
'$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl -dsuppress-uniques -dsuppress-ticks T15631.hs | grep 'case'
# Expecting one fewwer case expressions after fixing #15631
+
+T17140:
+ $(RM) -f T17140*.hi T17140*.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make -O T17140 T17140a -v0
diff --git a/testsuite/tests/simplCore/should_compile/T17140.hs b/testsuite/tests/simplCore/should_compile/T17140.hs
new file mode 100644
index 0000000000..5fed76d539
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T17140.hs
@@ -0,0 +1,8 @@
+module T17140 where
+
+import T17140a
+
+data B = B A
+
+mapP_B :: (Int -> Int) -> B -> B
+mapP_B f (B t) = B (mapP_A f t)
diff --git a/testsuite/tests/simplCore/should_compile/T17140.hs-boot b/testsuite/tests/simplCore/should_compile/T17140.hs-boot
new file mode 100644
index 0000000000..a0b8d43509
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T17140.hs-boot
@@ -0,0 +1,5 @@
+module T17140 where
+
+data B
+
+mapP_B :: (Int -> Int) -> B -> B
diff --git a/testsuite/tests/simplCore/should_compile/T17140a.hs b/testsuite/tests/simplCore/should_compile/T17140a.hs
new file mode 100644
index 0000000000..ae1fa591b4
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T17140a.hs
@@ -0,0 +1,8 @@
+module T17140a where
+
+import {-# SOURCE #-} T17140
+
+data A = A B
+
+mapP_A :: (Int -> Int) -> A -> A
+mapP_A _ (A xs) = A (mapP_B id xs)
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 94406ba5ca..35933e8be4 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -308,3 +308,7 @@ test('T16918a', normal, compile, ['-O'])
test('T16978', normal, compile, ['-O'])
test('T16979a', normal, compile, ['-O'])
test('T16979b', normal, compile, ['-O'])
+test('T17140',
+ [extra_files(['T17140a.hs'])],
+ makefile_test,
+ ['T17140']) \ No newline at end of file