diff options
author | Alain Frisch <alain@frisch.fr> | 2019-04-01 09:34:35 +0200 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2019-04-01 09:36:26 +0200 |
commit | b7e3ca750a6ff025d796f860ae3fea689f4cdae2 (patch) | |
tree | 83432f8e7a49952ad31e306280dd7ff2e21216de /testsuite | |
parent | d84c3aaa5cd763b3ba1b7950714452a9704f7880 (diff) | |
download | ocaml-b7e3ca750a6ff025d796f860ae3fea689f4cdae2.tar.gz |
Use Strict bindings when simplifying Lstaticraise (#8559)
Alias bindings were used before, but as #8558 shows this can be incorrect,
as the argument to `Lstaticraise` may be impure.
Adds a regression test.
Closes: #8558
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/tests/basic/localfunction.ml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/tests/basic/localfunction.ml b/testsuite/tests/basic/localfunction.ml index 31a757e052..6ea7b5d76a 100755 --- a/testsuite/tests/basic/localfunction.ml +++ b/testsuite/tests/basic/localfunction.ml @@ -21,3 +21,12 @@ let () = Printf.printf "%i\n%!" !r; assert(x1 -. x0 = x2 -. x1) (* check that we did not allocated anything between x1 and x2 *) + + +let () = + (* #8558 *) + let f () = () in + let r = ref 0 in + let g () = f (incr r) in + g (); + assert (!r = 1) |