Add a test to make sure we don't regress on #17140 in the future
authorAlp Mestanogullari <alpmestan@gmail.com>
Tue, 10 Sep 2019 08:57:26 +0000 (10:57 +0200)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Fri, 13 Sep 2019 07:11:50 +0000 (03:11 -0400)
testsuite/tests/simplCore/should_compile/Makefile
testsuite/tests/simplCore/should_compile/T17140.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/T17140.hs-boot [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/T17140a.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/all.T

index 4b71bf3..c27458c 100644 (file)
@@ -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 (file)
index 0000000..5fed76d
--- /dev/null
@@ -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 (file)
index 0000000..a0b8d43
--- /dev/null
@@ -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 (file)
index 0000000..ae1fa59
--- /dev/null
@@ -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)
index 94406ba..35933e8 100644 (file)
@@ -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