summaryrefslogtreecommitdiff
path: root/testsuite/tests/cpranal/should_compile/T18109.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/cpranal/should_compile/T18109.hs')
-rw-r--r--testsuite/tests/cpranal/should_compile/T18109.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/cpranal/should_compile/T18109.hs b/testsuite/tests/cpranal/should_compile/T18109.hs
new file mode 100644
index 0000000000..5c52a187c9
--- /dev/null
+++ b/testsuite/tests/cpranal/should_compile/T18109.hs
@@ -0,0 +1,25 @@
+{-# OPTIONS_GHC -O2 -fforce-recomp -dno-typeable-binds #-}
+
+-- | These are all examples where the CPR worker should not return an unboxed
+-- singleton tuple of the field, but rather the single field directly.
+-- This is OK if the field indeed terminates quickly;
+-- see Note [No unboxed tuple for single, unlifted transit var]
+module T18109 where
+
+data F = F (Int -> Int)
+
+f :: Int -> F
+f n = F (+n)
+{-# NOINLINE f #-}
+
+data T = T (Int, Int)
+
+g :: T -> T
+g t@(T p) = p `seq` t
+{-# NOINLINE g #-}
+
+data U = U ![Int]
+
+h :: Int -> U
+h n = U [0..n]
+{-# NOINLINE h #-}