[commit: ghc] master: Add a test case from the nested CPR work (19ddd04)

git at git.haskell.org git at git.haskell.org
Thu Apr 19 16:23:47 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/19ddd04474a7bf7cff9c5a971cb908c7c06f100a/ghc

>---------------------------------------------------------------

commit 19ddd04474a7bf7cff9c5a971cb908c7c06f100a
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Tue Apr 17 12:46:13 2018 -0400

    Add a test case from the nested CPR work
    
    Reviewers: bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4565


>---------------------------------------------------------------

19ddd04474a7bf7cff9c5a971cb908c7c06f100a
 testsuite/tests/stranal/sigs/CaseBinderCPR.hs     | 15 +++++++++++++++
 testsuite/tests/stranal/sigs/CaseBinderCPR.stderr | 12 ++++++++++++
 testsuite/tests/stranal/sigs/all.T                |  1 +
 3 files changed, 28 insertions(+)

diff --git a/testsuite/tests/stranal/sigs/CaseBinderCPR.hs b/testsuite/tests/stranal/sigs/CaseBinderCPR.hs
new file mode 100644
index 0000000..13f2163
--- /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 0000000..f708813
--- /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 f28cda7..091a4f4 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, [''])



More information about the ghc-commits mailing list