diff options
Diffstat (limited to 'testsuite/tests/letrec/backreferences.ml')
| -rw-r--r-- | testsuite/tests/letrec/backreferences.ml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/letrec/backreferences.ml b/testsuite/tests/letrec/backreferences.ml new file mode 100644 index 0000000000..4a893225b1 --- /dev/null +++ b/testsuite/tests/letrec/backreferences.ml @@ -0,0 +1,18 @@ +(* testing backreferences; some compilation scheme may handle + differently recursive references to a mutually-recursive RHS + depending on whether it is before or after in the bindings list *) +type t = { x : t; y : t; z : t } + +let test = + let rec x = { x; y; z } + and y = { x; y; z } + and z = { x; y; z } + in + List.iter (fun (f, t_ref) -> + List.iter (fun t -> assert (f t == t_ref)) [x; y; z] + ) + [ + (fun t -> t.x), x; + (fun t -> t.y), y; + (fun t -> t.z), z; + ] |
