This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,20 @@
let[@zero_alloc] [@inline never] foo x = Base.Printf.failwithf "%d" x ()
let[@zero_alloc] [@inline never] bar x y = Base.Printf.invalid_argf "%d" (x + y) ()
let%expect_test "foo" =
let x = Sys.opaque_identity 5 in
(try foo x with
| Failure s ->
print_string s;
print_newline ());
[%expect {| 5 |}]
;;
let%expect_test "bar" =
let x = Sys.opaque_identity 5 in
(try bar x x with
| Invalid_argument s ->
print_string s;
print_newline ());
[%expect {| 10 |}]
;;