| 1 |
Exception or-patterns. |
| 2 |
|
| 3 |
$ bash ../test.sh <<'EOF' |
| 4 |
> let _ = |
| 5 |
> match () with |
| 6 |
> | () -> () |
| 7 |
> | exception (Exit | Failure _) -> () |
| 8 |
> EOF |
| 9 |
let _ = |
| 10 |
match () with |
| 11 |
| exception ((Exit | Failure _) as ___bisect_matched_value___) -> |
| 12 |
(match[@ocaml.warning "-4-8-9-11-26-27-28-33"] |
| 13 |
___bisect_matched_value___ |
| 14 |
with |
| 15 |
| Exit -> |
| 16 |
___bisect_visit___ 1; |
| 17 |
() |
| 18 |
| Failure _ -> |
| 19 |
___bisect_visit___ 2; |
| 20 |
() |
| 21 |
| _ -> ()); |
| 22 |
() |
| 23 |
| () -> |
| 24 |
___bisect_visit___ 0; |
| 25 |
() |
| 26 |
|
| 27 |
|
| 28 |
Mixed value-exception cases are partitioned. Order is preserved. Case are |
| 29 |
factored out into functions, whose parameters are the bound variables of the |
| 30 |
patterns. |
| 31 |
|
| 32 |
$ bash ../test.sh <<'EOF' |
| 33 |
> let _ = |
| 34 |
> match Exit with |
| 35 |
> | Exit as x | exception (Exit as x) -> ignore x; print_endline "foo" |
| 36 |
> | End_of_file as y | exception (End_of_file | Failure _ as y) -> |
| 37 |
> ignore y; print_endline "bar" |
| 38 |
> | _ -> print_endline "baz" |
| 39 |
> EOF |
| 40 |
let _ = |
| 41 |
let ___bisect_case_0___ x () = |
| 42 |
ignore x; |
| 43 |
___bisect_post_visit___ 0 (print_endline "foo") |
| 44 |
and ___bisect_case_1___ y () = |
| 45 |
ignore y; |
| 46 |
___bisect_post_visit___ 1 (print_endline "bar") |
| 47 |
in |
| 48 |
match Exit with |
| 49 |
| exception (Exit as x) -> |
| 50 |
___bisect_visit___ 4; |
| 51 |
___bisect_case_0___ x () |
| 52 |
| exception ((End_of_file | Failure _) as y as ___bisect_matched_value___) -> |
| 53 |
(match[@ocaml.warning "-4-8-9-11-26-27-28-33"] |
| 54 |
___bisect_matched_value___ |
| 55 |
with |
| 56 |
| End_of_file as y -> |
| 57 |
___bisect_visit___ 6; |
| 58 |
() |
| 59 |
| Failure _ as y -> |
| 60 |
___bisect_visit___ 7; |
| 61 |
() |
| 62 |
| _ -> ()); |
| 63 |
___bisect_case_1___ y () |
| 64 |
| Exit as x -> |
| 65 |
___bisect_visit___ 3; |
| 66 |
___bisect_case_0___ x () |
| 67 |
| End_of_file as y -> |
| 68 |
___bisect_visit___ 5; |
| 69 |
___bisect_case_1___ y () |
| 70 |
| _ -> |
| 71 |
___bisect_visit___ 8; |
| 72 |
___bisect_post_visit___ 2 (print_endline "baz") |