Debian Codegraph @

test/instrument/pattern/nary.t

raw
1 Tuple.
2
3 $ bash ../test.sh <<'EOF'
4 > let _ =
5 > match (`A, `C) with
6 > | ((`A | `B), (`C | `D)) -> print_endline "foo"
7 > EOF
8 let _ =
9 match (`A, `C) with
10 | ((`A | `B), (`C | `D)) as ___bisect_matched_value___ ->
11 (match[@ocaml.warning "-4-8-9-11-26-27-28-33"]
12 ___bisect_matched_value___
13 with
14 | `A, `C ->
15 ___bisect_visit___ 2;
16 ___bisect_visit___ 1;
17 ()
18 | `A, `D ->
19 ___bisect_visit___ 3;
20 ___bisect_visit___ 1;
21 ()
22 | `B, `C ->
23 ___bisect_visit___ 2;
24 ___bisect_visit___ 4;
25 ()
26 | `B, `D ->
27 ___bisect_visit___ 3;
28 ___bisect_visit___ 4;
29 ()
30 | _ -> ());
31 ___bisect_post_visit___ 0 (print_endline "foo")
32
33
34 Record.
35
36 $ bash ../test.sh <<'EOF'
37 > type t = {a : bool; b : bool}
38 > let _ =
39 > match {a = true; b = false} with
40 > | {a = true | false; b = true | false} -> print_endline "foo"
41 > EOF
42 type t = { a : bool; b : bool }
43
44 let _ =
45 match { a = true; b = false } with
46 | ___bisect_matched_value___ -> (
47 match ___bisect_matched_value___ with
48 | { a = true | false; b = true | false } ->
49 (match[@ocaml.warning "-4-8-9-11-26-27-28-33"]
50 ___bisect_matched_value___
51 with
52 | { a = true; b = true } ->
53 ___bisect_visit___ 2;
54 ___bisect_visit___ 1;
55 ()
56 | { a = true; b = false } ->
57 ___bisect_visit___ 3;
58 ___bisect_visit___ 1;
59 ()
60 | { a = false; b = true } ->
61 ___bisect_visit___ 2;
62 ___bisect_visit___ 4;
63 ()
64 | { a = false; b = false } ->
65 ___bisect_visit___ 3;
66 ___bisect_visit___ 4;
67 ()
68 | _ -> ());
69 ___bisect_post_visit___ 0 (print_endline "foo"))
70
71
72 Array.
73
74 $ bash ../test.sh <<'EOF'
75 > let _ =
76 > match [|`A; `C|] with
77 > | [|`A | `B; `C | `D|] -> print_endline "foo"
78 > | _ -> ()
79 > EOF
80 let _ =
81 match [| `A; `C |] with
82 | [| `A | `B; `C | `D |] as ___bisect_matched_value___ ->
83 (match[@ocaml.warning "-4-8-9-11-26-27-28-33"]
84 ___bisect_matched_value___
85 with
86 | [| `A; `C |] ->
87 ___bisect_visit___ 2;
88 ___bisect_visit___ 1;
89 ()
90 | [| `A; `D |] ->
91 ___bisect_visit___ 3;
92 ___bisect_visit___ 1;
93 ()
94 | [| `B; `C |] ->
95 ___bisect_visit___ 2;
96 ___bisect_visit___ 4;
97 ()
98 | [| `B; `D |] ->
99 ___bisect_visit___ 3;
100 ___bisect_visit___ 4;
101 ()
102 | _ -> ());
103 ___bisect_post_visit___ 0 (print_endline "foo")
104 | _ ->
105 ___bisect_visit___ 5;
106 ()