diff options
Diffstat (limited to 'testsuite/tests/linear/should_compile/anf.hs')
-rw-r--r-- | testsuite/tests/linear/should_compile/anf.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/linear/should_compile/anf.hs b/testsuite/tests/linear/should_compile/anf.hs new file mode 100644 index 0000000000..9f1982e397 --- /dev/null +++ b/testsuite/tests/linear/should_compile/anf.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE LinearTypes #-} +-- !! Data constructors with strict fields +-- This test should use -funbox-strict-fields + +module Main ( main ) where + +main = print (g (f t)) + +t = MkT 1 2 (3,4) (MkS 5 6) + +g (MkT x _ _ _) = x + +data T = MkT Int !Int !(Int,Int) !(S Int) + +data S a = MkS a a + + +{-# NOINLINE f #-} +f :: T -> T -- Takes apart the thing and puts it + -- back together differently +f (MkT x y (a,b) (MkS p q)) = MkT a b (p,q) (MkS x y) |