Skip to content

Commit

Permalink
Provide pattern info with branch log
Browse files Browse the repository at this point in the history
  • Loading branch information
lukstafi committed Jan 30, 2024
1 parent 018360d commit f0cad53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ppx_minidebug.ml
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,9 @@ let debug_case callback ~ret_descr ~ret_typ ~alt_typ kind i { pc_lhs; pc_guard;
(fun (descr_loc, pat, typ) -> !log_value ~loc ~typ ~descr_loc (pat2expr pat))
bound
in
(* let message = pat2descr ~default:"__case" pc_lhs in *)
let message = "<" ^ kind ^ " -- branch " ^ string_of_int i ^ ">" in
let message = pat2descr ~default:"_" pc_lhs in
let message = if String.equal message.txt "_" then "" else " " ^ message.txt in
let message = "<" ^ kind ^ " -- branch " ^ string_of_int i ^ ">" ^ message in
let ret_descr =
match ret_descr with
| None -> { loc = pc_rhs.pexp_loc; txt = kind ^ "__res" }
Expand Down
2 changes: 1 addition & 1 deletion test/test_expect_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ let%expect_test "%debug_show PrintBox tracking <function>" =
BEGIN DEBUG SESSION
"test/test_expect_test.ml":549:11-549:12: <function -- branch 3>
4
"test/test_expect_test.ml":551:11-551:14: <function -- branch 5>
"test/test_expect_test.ml":551:11-551:14: <function -- branch 5> x
-3
|}]

Expand Down

0 comments on commit f0cad53

Please sign in to comment.