summaryrefslogtreecommitdiff
path: root/testsuite/tests/backtrace/methods.ml
blob: 7a449c4a2794a23c35c5076fc145a7dcd9c2d30e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(* TEST_BELOW
(* Blank lines added here to preserve locations. *)
*)

let[@inline never] id x = Sys.opaque_identity x

class foo = object (self)
  val other = new bar "asdf"
  method go : unit =
    id (other#go 1 2 3)
end
and bar _v = object (self)
  method go _ _ _ : unit =
    id (self#bang)
  method bang : unit =
    raise Exit
end

let () =
  Printexc.record_backtrace true;
  let obj = object (self)
    method meth : unit =
      id ((new foo)#go)
  end in
  match obj#meth with
  | _ -> assert false
  | exception Exit ->
     Printexc.print_backtrace stdout

(* TEST
 flags = "-g";
*)