| 1 |
In logical AND, control might not reach the second argument, so it is |
| 2 |
instrumented. |
| 3 |
|
| 4 |
$ bash ../test.sh <<'EOF' |
| 5 |
> let _ = true && false |
| 6 |
> let _ = (true & false) [@ocaml.warning "-3"] |
| 7 |
> EOF |
| 8 |
let _ = |
| 9 |
true |
| 10 |
&& |
| 11 |
(___bisect_visit___ 0; |
| 12 |
false) |
| 13 |
|
| 14 |
let _ = |
| 15 |
(true |
| 16 |
& |
| 17 |
(___bisect_visit___ 1; |
| 18 |
false)) |
| 19 |
[@ocaml.warning "-3"] |
| 20 |
|
| 21 |
|
| 22 |
Recursive instrumentation of subexpressions. |
| 23 |
|
| 24 |
$ bash ../test.sh <<'EOF' |
| 25 |
> let _ = (bool_of_string "true") && (bool_of_string "false") |
| 26 |
> let _ = |
| 27 |
> ((bool_of_string "true") & (bool_of_string "false")) [@ocaml.warning "-3"] |
| 28 |
> EOF |
| 29 |
let _ = |
| 30 |
___bisect_post_visit___ 0 (bool_of_string "true") |
| 31 |
&& |
| 32 |
(___bisect_visit___ 2; |
| 33 |
___bisect_post_visit___ 1 (bool_of_string "false")) |
| 34 |
|
| 35 |
let _ = |
| 36 |
(___bisect_post_visit___ 3 (bool_of_string "true") |
| 37 |
& |
| 38 |
(___bisect_visit___ 5; |
| 39 |
___bisect_post_visit___ 4 (bool_of_string "false"))) |
| 40 |
[@ocaml.warning "-3"] |
| 41 |
|
| 42 |
|
| 43 |
Partial application. See https://github.com/aantron/bisect_ppx/issues/333. |
| 44 |
|
| 45 |
$ bash ../test.sh <<'EOF' |
| 46 |
> [@@@ocaml.warning "-5"] |
| 47 |
> let _ = (&&) (List.mem 0 []) |
| 48 |
> EOF |
| 49 |
[@@@ocaml.warning "-5"] |
| 50 |
|
| 51 |
let _ = ( && ) (___bisect_post_visit___ 0 (List.mem 0 [])) |
| 52 |
|
| 53 |
|
| 54 |
The second subexpression is not post-instrumented if it is in tail position. |
| 55 |
|
| 56 |
$ bash ../test.sh <<'EOF' |
| 57 |
> let f _ = (bool_of_string "true") && (bool_of_string "false") |
| 58 |
> EOF |
| 59 |
let f _ = |
| 60 |
___bisect_visit___ 2; |
| 61 |
___bisect_post_visit___ 0 (bool_of_string "true") |
| 62 |
&& |
| 63 |
(___bisect_visit___ 1; |
| 64 |
bool_of_string "false") |