Debian Codegraph @

test/instrument/pattern/when.t

raw
1 If there is a pattern guard, pattern instrumentation is placed on it instead.
2 The nested expression gets a fresh instrumentation point, being the out-edge of
3 the guard, rather than the pattern.
4
5 $ bash ../test.sh <<'EOF'
6 > let _ =
7 > match `A `B with
8 > | `A (`B | `C) when print_endline "foo"; true -> ()
9 > | _ -> ()
10 > EOF
11 let _ =
12 match `A `B with
13 | `A (`B | `C) as ___bisect_matched_value___
14 when (match[@ocaml.warning "-4-8-9-11-26-27-28-33"]
15 ___bisect_matched_value___
16 with
17 | `A `B ->
18 ___bisect_visit___ 1;
19 ()
20 | `A `C ->
21 ___bisect_visit___ 2;
22 ()
23 | _ -> ());
24 ___bisect_post_visit___ 0 (print_endline "foo");
25 true ->
26 ___bisect_visit___ 3;
27 ()
28 | _ ->
29 ___bisect_visit___ 4;
30 ()
31
32 $ bash ../test.sh <<'EOF'
33 > let _ =
34 > match () with
35 > | () -> ()
36 > | exception (Exit | Failure _) when print_endline "foo"; true -> ()
37 > EOF
38 let _ =
39 match () with
40 | exception ((Exit | Failure _) as ___bisect_matched_value___)
41 when (match[@ocaml.warning "-4-8-9-11-26-27-28-33"]
42 ___bisect_matched_value___
43 with
44 | Exit ->
45 ___bisect_visit___ 2;
46 ()
47 | Failure _ ->
48 ___bisect_visit___ 3;
49 ()
50 | _ -> ());
51 ___bisect_post_visit___ 0 (print_endline "foo");
52 true ->
53 ___bisect_visit___ 4;
54 ()
55 | () ->
56 ___bisect_visit___ 1;
57 ()