summaryrefslogtreecommitdiff
path: root/testsuite/tests/cpranal/sigs/T19232.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/cpranal/sigs/T19232.hs')
-rw-r--r--testsuite/tests/cpranal/sigs/T19232.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/cpranal/sigs/T19232.hs b/testsuite/tests/cpranal/sigs/T19232.hs
new file mode 100644
index 0000000000..3ea087d585
--- /dev/null
+++ b/testsuite/tests/cpranal/sigs/T19232.hs
@@ -0,0 +1,14 @@
+module T19232 where
+
+-- | `x` is not used strictly and hence will not be available unboxed, so
+-- the `otherwise` RHS does not have the CPR property, even if it returns
+-- a case binder.
+f :: Bool -> Int -> Int
+f True x
+ | x == 3 = 8
+ | otherwise = x -- NB: the condition was flipped so that we can't substitute `x` for a constant here
+f False _ = 3
+{-# NOINLINE f #-}
+
+-- See also test CaseBinderCPR
+