summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2018-04-17 12:46:13 -0400
committerBen Gamari <ben@smart-cactus.org>2018-04-19 11:28:03 -0400
commit19ddd04474a7bf7cff9c5a971cb908c7c06f100a (patch)
tree89e2e5a9f5dc9c491c53e759d39a409f5ae0029b
parent2fdfe056812ec469a05f46f228ef076942297b5f (diff)
downloadhaskell-19ddd04474a7bf7cff9c5a971cb908c7c06f100a.tar.gz
Add a test case from the nested CPR work
Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D4565
-rw-r--r--testsuite/tests/stranal/sigs/CaseBinderCPR.hs15
-rw-r--r--testsuite/tests/stranal/sigs/CaseBinderCPR.stderr12
-rw-r--r--testsuite/tests/stranal/sigs/all.T1
3 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/stranal/sigs/CaseBinderCPR.hs b/testsuite/tests/stranal/sigs/CaseBinderCPR.hs
new file mode 100644
index 0000000000..13f216347d
--- /dev/null
+++ b/testsuite/tests/stranal/sigs/CaseBinderCPR.hs
@@ -0,0 +1,15 @@
+module CaseBinderCPR where
+
+-- This example, taken from nofib's transform (and heavily reduced) ensures that
+-- CPR information is added to a case binder
+
+f_list_cmp::(t1 -> t1 -> Int) -> [t1] -> [t1] -> Int;
+f_list_cmp a_cmp [] []= 0
+f_list_cmp a_cmp [] a_ys= -1
+f_list_cmp a_cmp a_xs []= 1
+f_list_cmp a_cmp (a_x:a_xs) (a_y:a_ys)=
+ if r_order == 0
+ then f_list_cmp a_cmp a_xs a_ys
+ else r_order
+ where
+ r_order = a_cmp a_x a_y
diff --git a/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr b/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr
new file mode 100644
index 0000000000..f708813a81
--- /dev/null
+++ b/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr
@@ -0,0 +1,12 @@
+
+==================== Strictness signatures ====================
+CaseBinderCPR.$trModule: m
+CaseBinderCPR.f_list_cmp: <L,C(C1(U(U)))><S,1*U><S,1*U>m
+
+
+
+==================== Strictness signatures ====================
+CaseBinderCPR.$trModule: m
+CaseBinderCPR.f_list_cmp: <L,C(C1(U(1*U)))><S,1*U><S,1*U>m
+
+
diff --git a/testsuite/tests/stranal/sigs/all.T b/testsuite/tests/stranal/sigs/all.T
index f28cda7b89..091a4f47ee 100644
--- a/testsuite/tests/stranal/sigs/all.T
+++ b/testsuite/tests/stranal/sigs/all.T
@@ -16,3 +16,4 @@ test('UnsatFun', normal, compile, [''])
test('BottomFromInnerLambda', normal, compile, [''])
test('DmdAnalGADTs', normal, compile, [''])
test('T12370', normal, compile, [''])
+test('CaseBinderCPR', normal, compile, [''])