summaryrefslogtreecommitdiff
path: root/testsuite/tests/letrec/evaluation_order_2.ml
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2012-01-18 08:31:11 +0000
committerAlain Frisch <alain@frisch.fr>2012-01-18 08:31:11 +0000
commitc45bcb892d78f3182acb2805aef7ec6e23cce42a (patch)
treeb92b5d6becb9e67a198bc2e070d748eeef62bc3d /testsuite/tests/letrec/evaluation_order_2.ml
parentcdbb84ec682704379bac21a633cbd2b9e93b35a8 (diff)
parent869feeb00704e0640c45ffe6aee6cc13e4077f79 (diff)
downloadocaml-unused_declarations.tar.gz
Synchronize with trunk.unused_declarations
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/unused_declarations@12034 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'testsuite/tests/letrec/evaluation_order_2.ml')
-rw-r--r--testsuite/tests/letrec/evaluation_order_2.ml18
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/letrec/evaluation_order_2.ml b/testsuite/tests/letrec/evaluation_order_2.ml
new file mode 100644
index 0000000000..736f82ad32
--- /dev/null
+++ b/testsuite/tests/letrec/evaluation_order_2.ml
@@ -0,0 +1,18 @@
+(* A variant of evaluation_order_1.ml where the side-effects
+ are inside the blocks. Note that this changes the evaluation
+ order, as y is considered recursive.
+*)
+type tree = Tree of tree list
+
+let test =
+ let rec x = (Tree [(print_endline "x"; y); z])
+ and y = Tree (print_endline "y"; [])
+ and z = Tree (print_endline "z"; [x])
+ in
+ match (x, y, z) with
+ | (Tree [y1; z1], Tree[], Tree[x1]) ->
+ assert (y1 == y);
+ assert (z1 == z);
+ assert (x1 == x)
+ | _ ->
+ assert false