summaryrefslogtreecommitdiff
path: root/testsuite/tests/letrec/record_with.ml
diff options
context:
space:
mode:
authorLuc Maranget <luc.maranget@inria.fr>2014-03-13 12:44:09 +0000
committerLuc Maranget <luc.maranget@inria.fr>2014-03-13 12:44:09 +0000
commit1f5876189e29730e9b8f40c2808d1d7b84a37af0 (patch)
tree948ec02afaa09b40f4e8e8344cd99463ad96add8 /testsuite/tests/letrec/record_with.ml
parentf69e779f366e356ffb03a9d334465dc073ee6c08 (diff)
downloadocaml-1f5876189e29730e9b8f40c2808d1d7b84a37af0.tar.gz
Merge with ocaml trunk 12778 -> 13774
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/jocamltrunk@14456 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'testsuite/tests/letrec/record_with.ml')
-rw-r--r--testsuite/tests/letrec/record_with.ml37
1 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/letrec/record_with.ml b/testsuite/tests/letrec/record_with.ml
new file mode 100644
index 0000000000..daaa88c474
--- /dev/null
+++ b/testsuite/tests/letrec/record_with.ml
@@ -0,0 +1,37 @@
+(***********************************************************************)
+(* *)
+(* OCaml *)
+(* *)
+(* Damien Doligez, projet Gallium, INRIA Rocquencourt *)
+(* *)
+(* Copyright 2012 Institut National de Recherche en Informatique et *)
+(* en Automatique. All rights reserved. This file is distributed *)
+(* under the terms of the Q Public License version 1.0. *)
+(* *)
+(***********************************************************************)
+
+
+(* A regression test for both PR#4141 and PR#5819: when a recursive
+ variable is defined by a { record with ... } expression.
+*)
+
+type t = {
+ self : t;
+ t0 : int;
+ t1 : int;
+ t2 : int;
+ t3 : int;
+ t4 : int;
+};;
+let rec t = {
+ self = t;
+ t0 = 42;
+ t1 = 42;
+ t2 = 42;
+ t3 = 42;
+ t4 = 42;
+};;
+
+let rec self = { t with self=self } in
+Printf.printf "%d\n" self.self.t0
+;;