forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When local exceptions are turned into jumps, unboxing applies. However in this example, the argument of Exit3
doesn't get unboxed.
type 'a ref = { mutable contents : 'a }
external ref : 'a -> 'a ref = "%makemutable"
external ( ! ) : 'a ref -> 'a = "%field0"
external ( := ) : 'a ref -> 'a -> unit = "%setfield0"
external ( < ) : 'a -> 'a -> bool = "%lessthan"
external ( + ) : int -> int -> int = "%addint"
external ( +. ) : float -> float -> float = "%addfloat"
external raise : exn -> 'a = "%raise"
external raise_notrace : exn -> 'a = "%raise_notrace"
exception Exit3 of int option
let f5 x g =
let r = ref x in
try
while !r < 42 do
if
try g !r
with _ -> false
then begin
if !r < 4 then raise_notrace (Exit3 (Some (!r + 2)))
else raise_notrace (Exit3 None)
end;
r := !r + 1
done;
0
with (Exit3 x) ->
match x with
| None -> 4
| Some x -> x + 5
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working