summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonmar <unknown>1999-07-14 12:31:14 +0000
committersimonmar <unknown>1999-07-14 12:31:14 +0000
commitfc23a3d939067d47c03509d62c96f4ae76833059 (patch)
tree2aad789e3bdf5b4ba4f018ac7ff2898cdf7ecc40
parent1824ff0e04fe12cc1367193f1a3e840337d7c16c (diff)
downloadhaskell-fc23a3d939067d47c03509d62c96f4ae76833059.tar.gz
[project @ 1999-07-14 12:31:14 by simonmar]
Recover the -funbox-strict-fields test.
-rw-r--r--ghc/tests/deSugar/should_compile/ds046.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/ghc/tests/deSugar/should_compile/ds046.hs b/ghc/tests/deSugar/should_compile/ds046.hs
new file mode 100644
index 0000000000..15d71995a4
--- /dev/null
+++ b/ghc/tests/deSugar/should_compile/ds046.hs
@@ -0,0 +1,30 @@
+module Test where
+
+-- Strict field unpacking tests: compile with -O -funbox-strict-fields.
+
+-- test 1: simple unboxed int field
+data T = T !Int
+t (T i) = i + 1
+
+-- test 2: mutual recursion (should back off from unboxing either field)
+data R = R !R
+data S = S !S
+
+r (R s) = s
+
+-- test 3: multi-level unboxing
+data A = A Int !B Int
+data B = B !Int
+
+f = A 1 (B 2) 1
+g (A x (B y) z) = A x (B (y+2)) z
+h (A x (B y) z) = y + 2
+
+-- test 4: flattening nested tuples
+data C = C !(Int,Int)
+j (C (a,b)) = a + b
+
+-- test 5: polymorphism, multiple strict fields
+data D a b = D Int !(a,b) !(E Int)
+data E a = E a
+k (D a (b,c) (E d)) = a + b + c + d