From 11456491bd51dc3725aae4703369a17092afef9a Mon Sep 17 00:00:00 2001 From: Lukasz Stafiniak Date: Sun, 25 Aug 2024 15:43:06 +0200 Subject: [PATCH] Fixes #58: get rid of `_rtb_` and `_lb_` --- CHANGELOG.md | 11 +- README.md | 26 +- debug-test.log | 1275 -------------------------------------- index.mld | 26 +- ppx_minidebug.ml | 70 +-- test/test_expect_test.ml | 693 +++++++++++---------- 6 files changed, 403 insertions(+), 1698 deletions(-) delete mode 100644 debug-test.log diff --git a/CHANGELOG.md b/CHANGELOG.md index 41e0b87..30ac4f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,11 @@ -## [2.0.0] -- current - -Great simplification: release 2.0 has in some regards less flexibility than earlier releases, but it's easier to use. +## [2.0.0] -- 2024-08-25 ### Changed -- Move `no_debug_if` to the generic interface (the last remaining non-config functionality missing from it). It's ignored (no-op) for the flushing backend. -- Move to linear log levels per-entry and per-log, where an unspecified log level inherits from the entry it's in, determined statically. -- Remove `_this_` infix and make all extension points behave as `_this_` (not extend to bodies of toplevel bindings). +- Moved `no_debug_if` to the generic interface (the last remaining non-config functionality missing from it). It's ignored (no-op) for the flushing backend. +- Moved to linear log levels per-entry and per-log, where an unspecified log level inherits from the entry it's in, determined statically. +- Removed `_this_` infix and make all extension points behave as `_this_` (not extend to bodies of toplevel bindings). +- Removed `_rtb_` and `_lb_` -- all debugging should use the generic interface as it now offers all the functionality except configuration. ## [1.6.1] -- 2024-08-21 diff --git a/README.md b/README.md index 01caae6..26c729f 100644 --- a/README.md +++ b/README.md @@ -199,9 +199,9 @@ The entry extension points vary along three axes: - The prefix `%debug_` means logging fewer things: only let-bound values and functions are logged, and functions only when either: directly in a `%debug_`-annotated let binding, or their return type is annotated. - `%track_` also logs: which `if`, `match`, `function` branch is taken, `for` and `while` loops, and all functions, including anonymous ones. - The prefix `%diagn_` means only generating logs for explicitly logged values, i.e. introduced by `[%log_entry]`, `[%log ...]`, `[%log_result ...]` and `[%log_printbox ...]` statements. -- Optional infixes `_rt_` and `_rtb_` add a first-class module argument to a function, and unpack it as `module Debug_runtime` for the scope of the function. - - `_rt_` uses the module type `Minidebug_runtime.Debug_runtime`. - - `_rtb_` uses the module type `Minidebug_runtime.PrintBox_runtime`. +- Optional infixes `_rt_` and `_l_`: + - `_rt_` adds a first-class module argument to a function, and unpacks it as `module Debug_runtime` for the scope of the function. + - `_l_` calls `_get_local_debug_runtime`, and unpacks it for the scope of the function: `let module Debug_runtime = (val _get_local_debug_runtime ()) in ...`. - This functionality is "one use only": it applies only to the function the extension point is attached to. - Representation and printing mechanism: `_pp`, `_show`, recommended: `_sexp` - `_pp` is currently most restrictive as it requires the type of a value to be an identifier. The identifier is converted to a `pp_` printing function, e.g. `pp_int`. @@ -484,7 +484,7 @@ The `%diagn_` extension points further restrict logging to explicit logs only. E At runtime, the level can be set via `Minidebug_runtime.debug ~log_level` or `Minidebug_runtime.debug_file ~log_level` at runtime creation, or via `Debug_runtime.log_level := ...` later on, also for the flushing backend. Check out the test suite [test_expect_test.ml:"%log runtime log levels while-loop"](test/test_expect_test.ml#L2536) for examples: ```ocaml - let%track_rtb_sexp result () : int = + let%track_rt_sexp result () : int = let i = ref 0 in let j = ref 0 in while !i < 6 do @@ -501,8 +501,8 @@ At runtime, the level can be set via `Minidebug_runtime.debug ~log_level` or `Mi print_endline @@ Int.to_string (result - (Minidebug_runtime.debug ~values_first_mode:true ~log_level:2 - ~global_prefix:"Warning" ()) + Minidebug_runtime.( + forget_printbox @@ debug ~values_first_mode:true ~log_level:2 ~global_prefix:"Warning" ()) ()); ... ``` @@ -1277,7 +1277,9 @@ For programs with threads or domains running concurrently, you need to ensure th We offer three helpers for dealing with multiple debug runtimes. There is an optional runtime instance-level setting `global_prefix`, which adds the given information to all log headers coming from the instance. -There are extension points `%debug_lb_sexp`, `%track_lb_sexp`, `%debug_l_sexp`, etc. They call a function `_get_local_printbox_debug_runtime ()`, or `_get_local_debug_runtime ()` for the `_l_` variants, and unpack the argument as `module Debug_runtime` (in a function body). The feature helps using a runtime instance dedicated to a thread or domain, since for example `_get_local_debug_runtime` can retrieve the runtime using `Domain.DLS`. To avoid surprises, this feature only takes effect for directly annotated functions, and unpacks a `Debug_runtime` inside the function body, so that we get the appropriate runtime for the dynamic local scope. +There are extension points `%debug_l_sexp`, `%track_l_sexp`, etc. They call a function `_get_local_debug_runtime ()` and unpack the argument as `module Debug_runtime` (in a function body). The feature helps using a runtime instance dedicated to a thread or domain, since for example `_get_local_debug_runtime` can retrieve the runtime using `Domain.DLS`. To avoid surprises, this feature only takes effect for directly annotated functions, and unpacks a `Debug_runtime` inside the function body, so that we get the appropriate runtime for the dynamic local scope. + +NOTE: it's important to annotate functions that might be called from threads (spawned domains) using the `_l_` variants of extension points, e.g. `%debug_l_sexp` (not `%debug_sexp`!). For clearest output, should configure `_get_local_debug_runtime ()` to return the same runtime as the `Debug_runtime` module that is in a file-wide scope, when called from the main thread / main domain. Example from the test suite: @@ -1318,12 +1320,12 @@ Example from the test suite: |}] ``` -Another similar feature is the extension points `%debug_rtb_sexp`, `%track_rtb_sexp` `%debug_rt_sexp`, etc. They add a first-class module argument to a function, and unpack the argument as `module Debug_runtime`. At present, passing of the runtime instance to functions needs to be done manually. Note that only the function attached to the `_rt_` or `_rtb_` extension point is modified. +Another similar feature is the extension points `%debug_rt_sexp`, `%track_rt_sexp`, etc. They add a first-class module argument to a function, and unpack the argument as `module Debug_runtime`. At present, passing of the runtime instance to functions needs to be done manually. Note that only the function attached to the `_rt_` extension point is modified. Example from the test suite: ```ocaml - let%track_rtb_show foo l : int = + let%track_rt_show foo l : int = match (l : int list) with [] -> 7 | y :: _ -> y * 2 in let () = @@ -1332,7 +1334,7 @@ Example from the test suite: (Minidebug_runtime.debug ~global_prefix:"foo-1" ~values_first_mode:true ()) [ 7 ] in - let%track_rtb_show baz : int list -> int = function + let%track_rt_show baz : int list -> int = function | [] -> 7 | [ y ] -> y * 2 | [ y; z ] -> y + z @@ -1341,13 +1343,13 @@ Example from the test suite: let () = print_endline @@ Int.to_string @@ baz - (Minidebug_runtime.debug ~global_prefix:"baz-1" ~values_first_mode:true ()) + Minidebug_runtime.(forget_printbox @@ debug ~global_prefix:"baz-1" ~values_first_mode:true ()) [ 4 ] in let () = print_endline @@ Int.to_string @@ baz - (Minidebug_runtime.debug ~global_prefix:"baz-2" ~values_first_mode:true ()) + Minidebug_runtime.(forget_printbox @@ debug ~global_prefix:"baz-2" ~values_first_mode:true ()) [ 4; 5; 6 ] in [%expect diff --git a/debug-test.log b/debug-test.log deleted file mode 100644 index 9b851cb..0000000 --- a/debug-test.log +++ /dev/null @@ -1,1275 +0,0 @@ -File "test/test_expect_test.ml", line 1, characters 0-0: -diff --git a/_build/default/test/test_expect_test.ml b/_build/.sandbox/a93ec08265f6d754f57461baa9b7cb37/default/test/test_expect_test.ml.corrected -index a4cdb01..1b6223c 100644 ---- a/_build/default/test/test_expect_test.ml -+++ b/_build/.sandbox/a93ec08265f6d754f57461baa9b7cb37/default/test/test_expect_test.ml.corrected -@@ -2216,15 +2216,15 @@ let%expect_test "%track_show options values_first_mode" = - ├─"test/test_expect_test.ml":2195:21 - ├─l = (Some 7) - └─ Some y -- └─"test/test_expect_test.ml":2195:81 -+ └─"test/test_expect_test.ml":2196:39 - 14 - baz = 8 -- ├─"test/test_expect_test.ml":2197:74 -+ ├─"test/test_expect_test.ml":2199:74 - ├─ Some y - └─y = 4 - 8 - zoo = 9 -- ├─"test/test_expect_test.ml":2199:87 -+ ├─"test/test_expect_test.ml":2203:21 - ├─ Some (y, z) - ├─y = 4 - └─z = 5 -@@ -2250,30 +2250,30 @@ let%expect_test "%track_show list values_first_mode" = - {| - BEGIN DEBUG SESSION - foo = 14 -- ├─"test/test_expect_test.ml":2231:21 -+ ├─"test/test_expect_test.ml":2236:21 - └─ :: (y, _) -- ├─"test/test_expect_test.ml":2231:77 -+ ├─"test/test_expect_test.ml":2236:77 - └─y = 7 - 14 - bar = 14 -- ├─"test/test_expect_test.ml":2233:21 -+ ├─"test/test_expect_test.ml":2238:21 - ├─l = [7] - └─ :: (y, _) -- └─"test/test_expect_test.ml":2233:77 -+ └─"test/test_expect_test.ml":2238:77 - 14 - baz = 8 -- ├─"test/test_expect_test.ml":2237:15 -+ ├─"test/test_expect_test.ml":2242:15 - ├─ :: (y, []) - └─y = 4 - 8 - baz = 9 -- ├─"test/test_expect_test.ml":2238:18 -+ ├─"test/test_expect_test.ml":2243:18 - ├─ :: (y, :: (z, [])) - ├─y = 4 - └─z = 5 - 9 - baz = 10 -- ├─"test/test_expect_test.ml":2239:21 -+ ├─"test/test_expect_test.ml":2244:21 - ├─ :: (y, :: (z, _)) - ├─y = 4 - └─z = 5 -@@ -2312,22 +2312,22 @@ let%expect_test "%track_rtb_show list runtime passing" = - {| - BEGIN DEBUG SESSION foo-1 - foo = 14 -- ├─"test/test_expect_test.ml":2279:25 -+ ├─"test/test_expect_test.ml":2284:25 - └─foo-1 :: (y, _) -- ├─"test/test_expect_test.ml":2280:50 -+ ├─"test/test_expect_test.ml":2285:50 - └─y = 7 - 14 - - BEGIN DEBUG SESSION baz-1 - baz = 8 -- ├─"test/test_expect_test.ml":2290:15 -+ ├─"test/test_expect_test.ml":2295:15 - ├─baz-1 :: (y, []) - └─y = 4 - 8 - - BEGIN DEBUG SESSION baz-2 - baz = 10 -- ├─"test/test_expect_test.ml":2292:21 -+ ├─"test/test_expect_test.ml":2297:21 - ├─baz-2 :: (y, :: (z, _)) - ├─y = 4 - └─z = 5 -@@ -2347,23 +2347,23 @@ let%expect_test "%track_rt_show procedure runtime passing" = - [%expect - {| - BEGIN DEBUG SESSION bar-1 -- bar-1 bar begin "test/test_expect_test.ml":2333:24: -- bar-1 fun:test_expect_test:2333 begin "test/test_expect_test.ml":2333:29: -- bar-1 fun:test_expect_test:2333 end -+ bar-1 bar begin "test/test_expect_test.ml":2338:24: -+ bar-1 fun:test_expect_test:2338 begin "test/test_expect_test.ml":2338:29: -+ bar-1 fun:test_expect_test:2338 end - bar-1 bar end - - BEGIN DEBUG SESSION bar-2 -- bar-2 bar begin "test/test_expect_test.ml":2333:24: -- bar-2 fun:test_expect_test:2333 begin "test/test_expect_test.ml":2333:29: -- bar-2 fun:test_expect_test:2333 end -+ bar-2 bar begin "test/test_expect_test.ml":2338:24: -+ bar-2 fun:test_expect_test:2338 begin "test/test_expect_test.ml":2338:29: -+ bar-2 fun:test_expect_test:2338 end - bar-2 bar end - - BEGIN DEBUG SESSION foo-1 -- foo-1 foo begin "test/test_expect_test.ml":2336:24: -+ foo-1 foo begin "test/test_expect_test.ml":2341:24: - foo-1 foo end - - BEGIN DEBUG SESSION foo-2 -- foo-2 foo begin "test/test_expect_test.ml":2336:24: -+ foo-2 foo begin "test/test_expect_test.ml":2341:24: - foo-2 foo end - |}] - -@@ -2386,26 +2386,26 @@ let%expect_test "%track_rt_show nested procedure runtime passing" = - {| - BEGIN DEBUG SESSION - rt_test -- └─"test/test_expect_test.ml":2367:25 -+ └─"test/test_expect_test.ml":2372:25 - - BEGIN DEBUG SESSION foo-1 -- foo-1 foo begin "test/test_expect_test.ml":2369:26: -+ foo-1 foo begin "test/test_expect_test.ml":2374:26: - foo-1 foo end - - BEGIN DEBUG SESSION foo-2 -- foo-2 foo begin "test/test_expect_test.ml":2369:26: -+ foo-2 foo begin "test/test_expect_test.ml":2374:26: - foo-2 foo end - - BEGIN DEBUG SESSION bar-1 -- bar-1 bar begin "test/test_expect_test.ml":2368:26: -- bar-1 fun:test_expect_test:2368 begin "test/test_expect_test.ml":2368:31: -- bar-1 fun:test_expect_test:2368 end -+ bar-1 bar begin "test/test_expect_test.ml":2373:26: -+ bar-1 fun:test_expect_test:2373 begin "test/test_expect_test.ml":2373:31: -+ bar-1 fun:test_expect_test:2373 end - bar-1 bar end - - BEGIN DEBUG SESSION bar-2 -- bar-2 bar begin "test/test_expect_test.ml":2368:26: -- bar-2 fun:test_expect_test:2368 begin "test/test_expect_test.ml":2368:31: -- bar-2 fun:test_expect_test:2368 end -+ bar-2 bar begin "test/test_expect_test.ml":2373:26: -+ bar-2 fun:test_expect_test:2373 begin "test/test_expect_test.ml":2373:31: -+ bar-2 fun:test_expect_test:2373 end - bar-2 bar end - |}] - -@@ -2428,12 +2428,12 @@ let%expect_test "%log constant entries" = - {| - BEGIN DEBUG SESSION - foo = () -- ├─"test/test_expect_test.ml":2409:21 -+ ├─"test/test_expect_test.ml":2414:21 - ├─"This is the first log line" - ├─["This is the"; "2"; "log line"] - └─("This is the", 3, "or", 3.14, "log line") - bar -- ├─"test/test_expect_test.ml":2416:21 -+ ├─"test/test_expect_test.ml":2421:21 - ├─This is the first log line - ├─This is the - │ ├─2 -@@ -2462,7 +2462,7 @@ let%expect_test "%log with type annotations" = - {| - BEGIN DEBUG SESSION - foo = () -- ├─"test/test_expect_test.ml":2448:21 -+ ├─"test/test_expect_test.ml":2453:21 - ├─("This is like", 3, "or", 3.14, "above") - ├─("tau =", 6.28) - ├─[4; 1; 2; 3] -@@ -2490,7 +2490,7 @@ let%expect_test "%log with default type assumption" = - {| - BEGIN DEBUG SESSION - foo = () -- ├─"test/test_expect_test.ml":2474:21 -+ ├─"test/test_expect_test.ml":2479:21 - ├─"2*3" - ├─("This is like", "3", "or", "3.14", "above") - ├─("tau =", "2*3.14") -@@ -2515,29 +2515,29 @@ let%expect_test "%log track while-loop" = - [%expect - {| - BEGIN DEBUG SESSION -- "test/test_expect_test.ml":2497:17: result -- └─"test/test_expect_test.ml":2500:4: while:test_expect_test:2500 -- ├─"test/test_expect_test.ml":2501:6: -+ "test/test_expect_test.ml":2502:17: result -+ └─"test/test_expect_test.ml":2505:4: while:test_expect_test:2505 -+ ├─"test/test_expect_test.ml":2506:6: - │ ├─(1 i= 0) - │ ├─(2 i= 1) - │ └─(3 j= 1) -- ├─"test/test_expect_test.ml":2501:6: -+ ├─"test/test_expect_test.ml":2506:6: - │ ├─(1 i= 1) - │ ├─(2 i= 2) - │ └─(3 j= 3) -- ├─"test/test_expect_test.ml":2501:6: -+ ├─"test/test_expect_test.ml":2506:6: - │ ├─(1 i= 2) - │ ├─(2 i= 3) - │ └─(3 j= 6) -- ├─"test/test_expect_test.ml":2501:6: -+ ├─"test/test_expect_test.ml":2506:6: - │ ├─(1 i= 3) - │ ├─(2 i= 4) - │ └─(3 j= 10) -- ├─"test/test_expect_test.ml":2501:6: -+ ├─"test/test_expect_test.ml":2506:6: - │ ├─(1 i= 4) - │ ├─(2 i= 5) - │ └─(3 j= 15) -- └─"test/test_expect_test.ml":2501:6: -+ └─"test/test_expect_test.ml":2506:6: - ├─(1 i= 5) - ├─(2 i= 6) - └─(3 j= 21) -@@ -2581,39 +2581,39 @@ let%expect_test "%log runtime log levels while-loop" = - [%expect - {| - BEGIN DEBUG SESSION Everything -- "test/test_expect_test.ml":2543:28: Everything result -- ├─"test/test_expect_test.ml":2546:4: Everything while:test_expect_test:2546 -- │ ├─"test/test_expect_test.ml":2548:6: Everything -- │ │ ├─"test/test_expect_test.ml":2548:21: Everything then:test_expect_test:2548 -+ "test/test_expect_test.ml":2548:28: Everything result -+ ├─"test/test_expect_test.ml":2551:4: Everything while:test_expect_test:2551 -+ │ ├─"test/test_expect_test.ml":2553:6: Everything -+ │ │ ├─"test/test_expect_test.ml":2553:21: Everything then:test_expect_test:2553 - │ │ │ └─(ERROR: 1 i= 0) - │ │ ├─(WARNING: 2 i= 1) -- │ │ ├─"test/test_expect_test.ml":2551:11: Everything fun:test_expect_test:2551 -+ │ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 - │ │ └─(INFO: 3 j= 1) -- │ ├─"test/test_expect_test.ml":2548:6: Everything -- │ │ ├─"test/test_expect_test.ml":2548:21: Everything then:test_expect_test:2548 -+ │ ├─"test/test_expect_test.ml":2553:6: Everything -+ │ │ ├─"test/test_expect_test.ml":2553:21: Everything then:test_expect_test:2553 - │ │ │ └─(ERROR: 1 i= 1) - │ │ ├─(WARNING: 2 i= 2) -- │ │ ├─"test/test_expect_test.ml":2551:11: Everything fun:test_expect_test:2551 -+ │ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 - │ │ └─(INFO: 3 j= 3) -- │ ├─"test/test_expect_test.ml":2548:6: Everything -- │ │ ├─"test/test_expect_test.ml":2548:64: Everything else:test_expect_test:2548 -+ │ ├─"test/test_expect_test.ml":2553:6: Everything -+ │ │ ├─"test/test_expect_test.ml":2553:64: Everything else:test_expect_test:2553 - │ │ ├─(WARNING: 2 i= 3) -- │ │ ├─"test/test_expect_test.ml":2551:11: Everything fun:test_expect_test:2551 -+ │ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 - │ │ └─(INFO: 3 j= 6) -- │ ├─"test/test_expect_test.ml":2548:6: Everything -- │ │ ├─"test/test_expect_test.ml":2548:64: Everything else:test_expect_test:2548 -+ │ ├─"test/test_expect_test.ml":2553:6: Everything -+ │ │ ├─"test/test_expect_test.ml":2553:64: Everything else:test_expect_test:2553 - │ │ ├─(WARNING: 2 i= 4) -- │ │ ├─"test/test_expect_test.ml":2551:11: Everything fun:test_expect_test:2551 -+ │ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 - │ │ └─(INFO: 3 j= 10) -- │ ├─"test/test_expect_test.ml":2548:6: Everything -- │ │ ├─"test/test_expect_test.ml":2548:64: Everything else:test_expect_test:2548 -+ │ ├─"test/test_expect_test.ml":2553:6: Everything -+ │ │ ├─"test/test_expect_test.ml":2553:64: Everything else:test_expect_test:2553 - │ │ ├─(WARNING: 2 i= 5) -- │ │ ├─"test/test_expect_test.ml":2551:11: Everything fun:test_expect_test:2551 -+ │ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 - │ │ └─(INFO: 3 j= 15) -- │ └─"test/test_expect_test.ml":2548:6: Everything -- │ ├─"test/test_expect_test.ml":2548:64: Everything else:test_expect_test:2548 -+ │ └─"test/test_expect_test.ml":2553:6: Everything -+ │ ├─"test/test_expect_test.ml":2553:64: Everything else:test_expect_test:2553 - │ ├─(WARNING: 2 i= 6) -- │ ├─"test/test_expect_test.ml":2551:11: Everything fun:test_expect_test:2551 -+ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 - │ └─(INFO: 3 j= 21) - └─result = 21 - 21 -@@ -2623,98 +2623,98 @@ let%expect_test "%log runtime log levels while-loop" = - - BEGIN DEBUG SESSION Error - result = 21 -- ├─"test/test_expect_test.ml":2543:28 -- └─Error while:test_expect_test:2546 -- ├─"test/test_expect_test.ml":2546:4 -+ ├─"test/test_expect_test.ml":2548:28 -+ └─Error while:test_expect_test:2551 -+ ├─"test/test_expect_test.ml":2551:4 - ├─Error -- │ ├─"test/test_expect_test.ml":2548:6 -- │ ├─Error then:test_expect_test:2548 -- │ │ ├─"test/test_expect_test.ml":2548:21 -+ │ ├─"test/test_expect_test.ml":2553:6 -+ │ ├─Error then:test_expect_test:2553 -+ │ │ ├─"test/test_expect_test.ml":2553:21 - │ │ └─(ERROR: 1 i= 0) -- │ └─Error fun:test_expect_test:2551 -- │ └─"test/test_expect_test.ml":2551:11 -+ │ └─Error fun:test_expect_test:2556 -+ │ └─"test/test_expect_test.ml":2556:11 - ├─Error -- │ ├─"test/test_expect_test.ml":2548:6 -- │ ├─Error then:test_expect_test:2548 -- │ │ ├─"test/test_expect_test.ml":2548:21 -+ │ ├─"test/test_expect_test.ml":2553:6 -+ │ ├─Error then:test_expect_test:2553 -+ │ │ ├─"test/test_expect_test.ml":2553:21 - │ │ └─(ERROR: 1 i= 1) -- │ └─Error fun:test_expect_test:2551 -- │ └─"test/test_expect_test.ml":2551:11 -+ │ └─Error fun:test_expect_test:2556 -+ │ └─"test/test_expect_test.ml":2556:11 - ├─Error -- │ ├─"test/test_expect_test.ml":2548:6 -- │ ├─Error else:test_expect_test:2548 -- │ │ └─"test/test_expect_test.ml":2548:64 -- │ └─Error fun:test_expect_test:2551 -- │ └─"test/test_expect_test.ml":2551:11 -+ │ ├─"test/test_expect_test.ml":2553:6 -+ │ ├─Error else:test_expect_test:2553 -+ │ │ └─"test/test_expect_test.ml":2553:64 -+ │ └─Error fun:test_expect_test:2556 -+ │ └─"test/test_expect_test.ml":2556:11 - ├─Error -- │ ├─"test/test_expect_test.ml":2548:6 -- │ ├─Error else:test_expect_test:2548 -- │ │ └─"test/test_expect_test.ml":2548:64 -- │ └─Error fun:test_expect_test:2551 -- │ └─"test/test_expect_test.ml":2551:11 -+ │ ├─"test/test_expect_test.ml":2553:6 -+ │ ├─Error else:test_expect_test:2553 -+ │ │ └─"test/test_expect_test.ml":2553:64 -+ │ └─Error fun:test_expect_test:2556 -+ │ └─"test/test_expect_test.ml":2556:11 - ├─Error -- │ ├─"test/test_expect_test.ml":2548:6 -- │ ├─Error else:test_expect_test:2548 -- │ │ └─"test/test_expect_test.ml":2548:64 -- │ └─Error fun:test_expect_test:2551 -- │ └─"test/test_expect_test.ml":2551:11 -+ │ ├─"test/test_expect_test.ml":2553:6 -+ │ ├─Error else:test_expect_test:2553 -+ │ │ └─"test/test_expect_test.ml":2553:64 -+ │ └─Error fun:test_expect_test:2556 -+ │ └─"test/test_expect_test.ml":2556:11 - └─Error -- ├─"test/test_expect_test.ml":2548:6 -- ├─Error else:test_expect_test:2548 -- │ └─"test/test_expect_test.ml":2548:64 -- └─Error fun:test_expect_test:2551 -- └─"test/test_expect_test.ml":2551:11 -+ ├─"test/test_expect_test.ml":2553:6 -+ ├─Error else:test_expect_test:2553 -+ │ └─"test/test_expect_test.ml":2553:64 -+ └─Error fun:test_expect_test:2556 -+ └─"test/test_expect_test.ml":2556:11 - 21 - - BEGIN DEBUG SESSION Warning - result = 21 -- ├─"test/test_expect_test.ml":2543:28 -- └─Warning while:test_expect_test:2546 -- ├─"test/test_expect_test.ml":2546:4 -+ ├─"test/test_expect_test.ml":2548:28 -+ └─Warning while:test_expect_test:2551 -+ ├─"test/test_expect_test.ml":2551:4 - ├─Warning -- │ ├─"test/test_expect_test.ml":2548:6 -- │ ├─Warning then:test_expect_test:2548 -- │ │ ├─"test/test_expect_test.ml":2548:21 -+ │ ├─"test/test_expect_test.ml":2553:6 -+ │ ├─Warning then:test_expect_test:2553 -+ │ │ ├─"test/test_expect_test.ml":2553:21 - │ │ └─(ERROR: 1 i= 0) - │ ├─(WARNING: 2 i= 1) -- │ └─Warning fun:test_expect_test:2551 -- │ └─"test/test_expect_test.ml":2551:11 -+ │ └─Warning fun:test_expect_test:2556 -+ │ └─"test/test_expect_test.ml":2556:11 - ├─Warning -- │ ├─"test/test_expect_test.ml":2548:6 -- │ ├─Warning then:test_expect_test:2548 -- │ │ ├─"test/test_expect_test.ml":2548:21 -+ │ ├─"test/test_expect_test.ml":2553:6 -+ │ ├─Warning then:test_expect_test:2553 -+ │ │ ├─"test/test_expect_test.ml":2553:21 - │ │ └─(ERROR: 1 i= 1) - │ ├─(WARNING: 2 i= 2) -- │ └─Warning fun:test_expect_test:2551 -- │ └─"test/test_expect_test.ml":2551:11 -+ │ └─Warning fun:test_expect_test:2556 -+ │ └─"test/test_expect_test.ml":2556:11 - ├─Warning -- │ ├─"test/test_expect_test.ml":2548:6 -- │ ├─Warning else:test_expect_test:2548 -- │ │ └─"test/test_expect_test.ml":2548:64 -+ │ ├─"test/test_expect_test.ml":2553:6 -+ │ ├─Warning else:test_expect_test:2553 -+ │ │ └─"test/test_expect_test.ml":2553:64 - │ ├─(WARNING: 2 i= 3) -- │ └─Warning fun:test_expect_test:2551 -- │ └─"test/test_expect_test.ml":2551:11 -+ │ └─Warning fun:test_expect_test:2556 -+ │ └─"test/test_expect_test.ml":2556:11 - ├─Warning -- │ ├─"test/test_expect_test.ml":2548:6 -- │ ├─Warning else:test_expect_test:2548 -- │ │ └─"test/test_expect_test.ml":2548:64 -+ │ ├─"test/test_expect_test.ml":2553:6 -+ │ ├─Warning else:test_expect_test:2553 -+ │ │ └─"test/test_expect_test.ml":2553:64 - │ ├─(WARNING: 2 i= 4) -- │ └─Warning fun:test_expect_test:2551 -- │ └─"test/test_expect_test.ml":2551:11 -+ │ └─Warning fun:test_expect_test:2556 -+ │ └─"test/test_expect_test.ml":2556:11 - ├─Warning -- │ ├─"test/test_expect_test.ml":2548:6 -- │ ├─Warning else:test_expect_test:2548 -- │ │ └─"test/test_expect_test.ml":2548:64 -+ │ ├─"test/test_expect_test.ml":2553:6 -+ │ ├─Warning else:test_expect_test:2553 -+ │ │ └─"test/test_expect_test.ml":2553:64 - │ ├─(WARNING: 2 i= 5) -- │ └─Warning fun:test_expect_test:2551 -- │ └─"test/test_expect_test.ml":2551:11 -+ │ └─Warning fun:test_expect_test:2556 -+ │ └─"test/test_expect_test.ml":2556:11 - └─Warning -- ├─"test/test_expect_test.ml":2548:6 -- ├─Warning else:test_expect_test:2548 -- │ └─"test/test_expect_test.ml":2548:64 -+ ├─"test/test_expect_test.ml":2553:6 -+ ├─Warning else:test_expect_test:2553 -+ │ └─"test/test_expect_test.ml":2553:64 - ├─(WARNING: 2 i= 6) -- └─Warning fun:test_expect_test:2551 -- └─"test/test_expect_test.ml":2551:11 -+ └─Warning fun:test_expect_test:2556 -+ └─"test/test_expect_test.ml":2556:11 - 21 - |}] - -@@ -2773,98 +2773,98 @@ let%expect_test "%log compile time log levels while-loop" = - {| - BEGIN DEBUG SESSION - everything = 21 -- ├─"test/test_expect_test.ml":2718:28 -- └─while:test_expect_test:2723 -- ├─"test/test_expect_test.ml":2723:6 -+ ├─"test/test_expect_test.ml":2723:28 -+ └─while:test_expect_test:2728 -+ ├─"test/test_expect_test.ml":2728:6 - ├─ -- │ ├─"test/test_expect_test.ml":2725:8 -- │ ├─then:test_expect_test:2725 -- │ │ ├─"test/test_expect_test.ml":2725:23 -+ │ ├─"test/test_expect_test.ml":2730:8 -+ │ ├─then:test_expect_test:2730 -+ │ │ ├─"test/test_expect_test.ml":2730:23 - │ │ └─(ERROR: 1 i= 0) - │ ├─(WARNING: 2 i= 1) -- │ ├─fun:test_expect_test:2728 -- │ │ └─"test/test_expect_test.ml":2728:13 -+ │ ├─fun:test_expect_test:2733 -+ │ │ └─"test/test_expect_test.ml":2733:13 - │ └─(INFO: 3 j= 1) - ├─ -- │ ├─"test/test_expect_test.ml":2725:8 -- │ ├─then:test_expect_test:2725 -- │ │ ├─"test/test_expect_test.ml":2725:23 -+ │ ├─"test/test_expect_test.ml":2730:8 -+ │ ├─then:test_expect_test:2730 -+ │ │ ├─"test/test_expect_test.ml":2730:23 - │ │ └─(ERROR: 1 i= 1) - │ ├─(WARNING: 2 i= 2) -- │ ├─fun:test_expect_test:2728 -- │ │ └─"test/test_expect_test.ml":2728:13 -+ │ ├─fun:test_expect_test:2733 -+ │ │ └─"test/test_expect_test.ml":2733:13 - │ └─(INFO: 3 j= 3) - ├─ -- │ ├─"test/test_expect_test.ml":2725:8 -- │ ├─else:test_expect_test:2725 -- │ │ └─"test/test_expect_test.ml":2725:66 -+ │ ├─"test/test_expect_test.ml":2730:8 -+ │ ├─else:test_expect_test:2730 -+ │ │ └─"test/test_expect_test.ml":2730:66 - │ ├─(WARNING: 2 i= 3) -- │ ├─fun:test_expect_test:2728 -- │ │ └─"test/test_expect_test.ml":2728:13 -+ │ ├─fun:test_expect_test:2733 -+ │ │ └─"test/test_expect_test.ml":2733:13 - │ └─(INFO: 3 j= 6) - ├─ -- │ ├─"test/test_expect_test.ml":2725:8 -- │ ├─else:test_expect_test:2725 -- │ │ └─"test/test_expect_test.ml":2725:66 -+ │ ├─"test/test_expect_test.ml":2730:8 -+ │ ├─else:test_expect_test:2730 -+ │ │ └─"test/test_expect_test.ml":2730:66 - │ ├─(WARNING: 2 i= 4) -- │ ├─fun:test_expect_test:2728 -- │ │ └─"test/test_expect_test.ml":2728:13 -+ │ ├─fun:test_expect_test:2733 -+ │ │ └─"test/test_expect_test.ml":2733:13 - │ └─(INFO: 3 j= 10) - ├─ -- │ ├─"test/test_expect_test.ml":2725:8 -- │ ├─else:test_expect_test:2725 -- │ │ └─"test/test_expect_test.ml":2725:66 -+ │ ├─"test/test_expect_test.ml":2730:8 -+ │ ├─else:test_expect_test:2730 -+ │ │ └─"test/test_expect_test.ml":2730:66 - │ ├─(WARNING: 2 i= 5) -- │ ├─fun:test_expect_test:2728 -- │ │ └─"test/test_expect_test.ml":2728:13 -+ │ ├─fun:test_expect_test:2733 -+ │ │ └─"test/test_expect_test.ml":2733:13 - │ └─(INFO: 3 j= 15) - └─ -- ├─"test/test_expect_test.ml":2725:8 -- ├─else:test_expect_test:2725 -- │ └─"test/test_expect_test.ml":2725:66 -+ ├─"test/test_expect_test.ml":2730:8 -+ ├─else:test_expect_test:2730 -+ │ └─"test/test_expect_test.ml":2730:66 - ├─(WARNING: 2 i= 6) -- ├─fun:test_expect_test:2728 -- │ └─"test/test_expect_test.ml":2728:13 -+ ├─fun:test_expect_test:2733 -+ │ └─"test/test_expect_test.ml":2733:13 - └─(INFO: 3 j= 21) - 21 - nothing = 21 -- └─"test/test_expect_test.ml":2733:25 -+ └─"test/test_expect_test.ml":2738:25 - 21 - warning = 21 -- ├─"test/test_expect_test.ml":2749:25 -- └─while:test_expect_test:2754 -- ├─"test/test_expect_test.ml":2754:6 -+ ├─"test/test_expect_test.ml":2754:25 -+ └─while:test_expect_test:2759 -+ ├─"test/test_expect_test.ml":2759:6 - ├─ -- │ ├─"test/test_expect_test.ml":2756:8 -- │ ├─then:test_expect_test:2756 -- │ │ ├─"test/test_expect_test.ml":2756:23 -+ │ ├─"test/test_expect_test.ml":2761:8 -+ │ ├─then:test_expect_test:2761 -+ │ │ ├─"test/test_expect_test.ml":2761:23 - │ │ └─(ERROR: 1 i= 0) - │ └─(WARNING: 2 i= 1) - ├─ -- │ ├─"test/test_expect_test.ml":2756:8 -- │ ├─then:test_expect_test:2756 -- │ │ ├─"test/test_expect_test.ml":2756:23 -+ │ ├─"test/test_expect_test.ml":2761:8 -+ │ ├─then:test_expect_test:2761 -+ │ │ ├─"test/test_expect_test.ml":2761:23 - │ │ └─(ERROR: 1 i= 1) - │ └─(WARNING: 2 i= 2) - ├─ -- │ ├─"test/test_expect_test.ml":2756:8 -- │ ├─else:test_expect_test:2756 -- │ │ └─"test/test_expect_test.ml":2756:66 -+ │ ├─"test/test_expect_test.ml":2761:8 -+ │ ├─else:test_expect_test:2761 -+ │ │ └─"test/test_expect_test.ml":2761:66 - │ └─(WARNING: 2 i= 3) - ├─ -- │ ├─"test/test_expect_test.ml":2756:8 -- │ ├─else:test_expect_test:2756 -- │ │ └─"test/test_expect_test.ml":2756:66 -+ │ ├─"test/test_expect_test.ml":2761:8 -+ │ ├─else:test_expect_test:2761 -+ │ │ └─"test/test_expect_test.ml":2761:66 - │ └─(WARNING: 2 i= 4) - ├─ -- │ ├─"test/test_expect_test.ml":2756:8 -- │ ├─else:test_expect_test:2756 -- │ │ └─"test/test_expect_test.ml":2756:66 -+ │ ├─"test/test_expect_test.ml":2761:8 -+ │ ├─else:test_expect_test:2761 -+ │ │ └─"test/test_expect_test.ml":2761:66 - │ └─(WARNING: 2 i= 5) - └─ -- ├─"test/test_expect_test.ml":2756:8 -- ├─else:test_expect_test:2756 -- │ └─"test/test_expect_test.ml":2756:66 -+ ├─"test/test_expect_test.ml":2761:8 -+ ├─else:test_expect_test:2761 -+ │ └─"test/test_expect_test.ml":2761:66 - └─(WARNING: 2 i= 6) - 21 - |}] -@@ -2924,44 +2924,44 @@ let%expect_test "%log compile time log levels runtime-passing while-loop" = - - BEGIN DEBUG SESSION warning - warning = 21 -- ├─"test/test_expect_test.ml":2895:33 -- └─warning while:test_expect_test:2898 -- ├─"test/test_expect_test.ml":2898:8 -+ ├─"test/test_expect_test.ml":2900:33 -+ └─warning while:test_expect_test:2903 -+ ├─"test/test_expect_test.ml":2903:8 - ├─warning -- │ ├─"test/test_expect_test.ml":2900:10 -- │ ├─warning then:test_expect_test:2900 -- │ │ ├─"test/test_expect_test.ml":2900:25 -+ │ ├─"test/test_expect_test.ml":2905:10 -+ │ ├─warning then:test_expect_test:2905 -+ │ │ ├─"test/test_expect_test.ml":2905:25 - │ │ └─(ERROR: 1 i= 0) - │ └─(WARNING: 2 i= 1) - ├─warning -- │ ├─"test/test_expect_test.ml":2900:10 -- │ ├─warning then:test_expect_test:2900 -- │ │ ├─"test/test_expect_test.ml":2900:25 -+ │ ├─"test/test_expect_test.ml":2905:10 -+ │ ├─warning then:test_expect_test:2905 -+ │ │ ├─"test/test_expect_test.ml":2905:25 - │ │ └─(ERROR: 1 i= 1) - │ └─(WARNING: 2 i= 2) - ├─warning -- │ ├─"test/test_expect_test.ml":2900:10 -- │ ├─warning else:test_expect_test:2900 -- │ │ └─"test/test_expect_test.ml":2900:68 -+ │ ├─"test/test_expect_test.ml":2905:10 -+ │ ├─warning else:test_expect_test:2905 -+ │ │ └─"test/test_expect_test.ml":2905:68 - │ └─(WARNING: 2 i= 3) - ├─warning -- │ ├─"test/test_expect_test.ml":2900:10 -- │ ├─warning else:test_expect_test:2900 -- │ │ └─"test/test_expect_test.ml":2900:68 -+ │ ├─"test/test_expect_test.ml":2905:10 -+ │ ├─warning else:test_expect_test:2905 -+ │ │ └─"test/test_expect_test.ml":2905:68 - │ └─(WARNING: 2 i= 4) - ├─warning -- │ ├─"test/test_expect_test.ml":2900:10 -- │ ├─warning else:test_expect_test:2900 -- │ │ └─"test/test_expect_test.ml":2900:68 -+ │ ├─"test/test_expect_test.ml":2905:10 -+ │ ├─warning else:test_expect_test:2905 -+ │ │ └─"test/test_expect_test.ml":2905:68 - │ └─(WARNING: 2 i= 5) - └─warning -- ├─"test/test_expect_test.ml":2900:10 -- ├─warning else:test_expect_test:2900 -- │ └─"test/test_expect_test.ml":2900:68 -+ ├─"test/test_expect_test.ml":2905:10 -+ ├─warning else:test_expect_test:2905 -+ │ └─"test/test_expect_test.ml":2905:68 - └─(WARNING: 2 i= 6) - 21 - TOPLEVEL () -- └─"test/test_expect_test.ml":2873:17 -+ └─"test/test_expect_test.ml":2878:17 - |}] - - let%expect_test "%log track while-loop result" = -@@ -2984,36 +2984,36 @@ let%expect_test "%log track while-loop result" = - {| - BEGIN DEBUG SESSION - 21 -- ├─"test/test_expect_test.ml":2964:17 -- └─while:test_expect_test:2967 -- ├─"test/test_expect_test.ml":2967:4 -+ ├─"test/test_expect_test.ml":2969:17 -+ └─while:test_expect_test:2972 -+ ├─"test/test_expect_test.ml":2972:4 - ├─(3 j= 1) -- │ ├─"test/test_expect_test.ml":2968:6 -+ │ ├─"test/test_expect_test.ml":2973:6 - │ ├─ - │ ├─(1 i= 0) - │ └─(2 i= 1) - ├─(3 j= 3) -- │ ├─"test/test_expect_test.ml":2968:6 -+ │ ├─"test/test_expect_test.ml":2973:6 - │ ├─ - │ ├─(1 i= 1) - │ └─(2 i= 2) - ├─(3 j= 6) -- │ ├─"test/test_expect_test.ml":2968:6 -+ │ ├─"test/test_expect_test.ml":2973:6 - │ ├─ - │ ├─(1 i= 2) - │ └─(2 i= 3) - ├─(3 j= 10) -- │ ├─"test/test_expect_test.ml":2968:6 -+ │ ├─"test/test_expect_test.ml":2973:6 - │ ├─ - │ ├─(1 i= 3) - │ └─(2 i= 4) - ├─(3 j= 15) -- │ ├─"test/test_expect_test.ml":2968:6 -+ │ ├─"test/test_expect_test.ml":2973:6 - │ ├─ - │ ├─(1 i= 4) - │ └─(2 i= 5) - └─(3 j= 21) -- ├─"test/test_expect_test.ml":2968:6 -+ ├─"test/test_expect_test.ml":2973:6 - ├─ - ├─(1 i= 5) - └─(2 i= 6) -@@ -3042,7 +3042,7 @@ let%expect_test "%log without scope" = - [%expect - {| - BEGIN DEBUG SESSION -- "test/test_expect_test.ml":3027:17: _bar {#1} -+ "test/test_expect_test.ml":3032:17: _bar {#1} - └─_bar = () - {orphaned from #1} - └─("This is like", 3, "or", 3.14, "above") -@@ -3078,7 +3078,7 @@ let%expect_test "%log without scope values_first_mode" = - {| - BEGIN DEBUG SESSION - _bar = () -- └─"test/test_expect_test.ml":3062:17 {#1} -+ └─"test/test_expect_test.ml":3067:17 {#1} - ("This is like", 3, "or", 3.14, "above") - └─{orphaned from #1} - ("tau =", 6.28) -@@ -3126,13 +3126,13 @@ let%expect_test "%log with print_entry_ids, mixed up scopes" = - {| - BEGIN DEBUG SESSION - bar = () -- └─"test/test_expect_test.ml":3099:21 {#1} -+ └─"test/test_expect_test.ml":3104:21 {#1} - baz = () -- └─"test/test_expect_test.ml":3106:21 {#2} -+ └─"test/test_expect_test.ml":3111:21 {#2} - bar = () -- └─"test/test_expect_test.ml":3099:21 {#3} -+ └─"test/test_expect_test.ml":3104:21 {#3} - _foobar = () -- ├─"test/test_expect_test.ml":3118:17 {#4} -+ ├─"test/test_expect_test.ml":3123:17 {#4} - ├─("This is like", 3, "or", 3.14, "above") - ├─("tau =", 6.28) - ├─[3; 1; 2; 3] -@@ -3186,13 +3186,13 @@ let%expect_test "%log with print_entry_ids, verbose_entry_ids in HTML, values_fi - [%expect - {| - BEGIN DEBUG SESSION --
{#1} bar = ()
  • "test/test_expect_test.ml":3160:21
-+
{#1} bar = ()
  • "test/test_expect_test.ml":3165:21
- --
{#2} baz = ()
  • "test/test_expect_test.ml":3167:21
-+
{#2} baz = ()
  • "test/test_expect_test.ml":3172:21
- --
{#3} bar = ()
  • "test/test_expect_test.ml":3160:21
-+
{#3} bar = ()
  • "test/test_expect_test.ml":3165:21
- --
{#4} _foobar = ()
  • "test/test_expect_test.ml":3179:17
  • {#3} ("This is like", 3, "or", 3.14, "above")
  • {#3} ("tau =", 6.28)
  • {#2} [3; 1; 2; 3]
  • {#2} [3; 1; 2; 3]
  • {#1} ("This is like", 3, "or", 3.14, "above")
  • {#1} ("tau =", 6.28)
-+
{#4} _foobar = ()
  • "test/test_expect_test.ml":3184:17
  • {#3} ("This is like", 3, "or", 3.14, "above")
  • {#3} ("tau =", 6.28)
  • {#2} [3; 1; 2; 3]
  • {#2} [3; 1; 2; 3]
  • {#1} ("This is like", 3, "or", 3.14, "above")
  • {#1} ("tau =", 6.28)
- -
{#2} [3; 1; 2; 3]
  • {orphaned from #2}
- -@@ -3227,7 +3227,7 @@ let%expect_test "%diagn_show ignores type annots" = - 336 - 109 - toplevel -- ├─"test/test_expect_test.ml":3203:17 -+ ├─"test/test_expect_test.ml":3208:17 - ├─("for bar, b-3", 42) - └─("for baz, f squared", 64) - |}] -@@ -3253,11 +3253,11 @@ let%expect_test "%diagn_show ignores non-empty bindings" = - {| - BEGIN DEBUG SESSION - bar -- ├─"test/test_expect_test.ml":3232:21 -+ ├─"test/test_expect_test.ml":3237:21 - └─("for bar, b-3", 42) - 336 - baz -- ├─"test/test_expect_test.ml":3239:21 -+ ├─"test/test_expect_test.ml":3244:21 - └─("foo baz, f squared", 49) - 91 - |}] -@@ -3316,16 +3316,16 @@ let%expect_test "%debug_show log level compile time" = - 336 - 109 - () -- ├─"test/test_expect_test.ml":3281:18 -+ ├─"test/test_expect_test.ml":3286:18 - ├─bar -- │ ├─"test/test_expect_test.ml":3290:14 -+ │ ├─"test/test_expect_test.ml":3295:14 - │ └─("for bar, b-3", 42) - └─baz = 109 -- ├─"test/test_expect_test.ml":3298:26 -+ ├─"test/test_expect_test.ml":3303:26 - ├─first = 7 - ├─second = 42 - ├─{first; second} -- │ ├─"test/test_expect_test.ml":3299:12 -+ │ ├─"test/test_expect_test.ml":3304:12 - │ └─ - │ ├─first = 8 - │ └─second = 45 -@@ -3368,11 +3368,11 @@ let%expect_test "%debug_show log level runtime" = - └─{orphaned from #5} - 336 - baz = 109 -- ├─"test/test_expect_test.ml":3349:24 -+ ├─"test/test_expect_test.ml":3354:24 - ├─first = 7 - ├─second = 42 - ├─{first; second} -- │ ├─"test/test_expect_test.ml":3350:10 -+ │ ├─"test/test_expect_test.ml":3355:10 - │ └─ - │ ├─first = 8 - │ └─second = 45 -@@ -3392,75 +3392,75 @@ let%expect_test "%debug_show PrintBox snapshot" = - {| - BEGIN DEBUG SESSION - loop_highlight -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 7 - └─z = 3 -- └─"test/test_expect_test.ml":3381:8 -+ └─"test/test_expect_test.ml":3386:8 - -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 7 - ├─z = 3 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 6 - ├─z = 2 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 5 - ├─z = 2 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 4 - ├─z = 1 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 3 - └─z = 1 -- └─"test/test_expect_test.ml":3381:8 -+ └─"test/test_expect_test.ml":3386:8 - -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 7 - ├─z = 3 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight = 6 -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 6 - ├─z = 2 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight = 4 -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 5 - ├─z = 2 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight = 2 -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 4 - ├─z = 1 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight = 1 -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 3 - ├─z = 1 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight = 0 -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 2 - ├─z = 0 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight = 0 -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 1 - ├─z = 0 -- │ └─"test/test_expect_test.ml":3381:8 -+ │ └─"test/test_expect_test.ml":3386:8 - └─loop_highlight = 0 -- ├─"test/test_expect_test.ml":3380:36 -+ ├─"test/test_expect_test.ml":3385:36 - ├─x = 0 - └─z = 0 -- └─"test/test_expect_test.ml":3381:8 -+ └─"test/test_expect_test.ml":3386:8 - 9 - |}] - -@@ -3502,7 +3502,7 @@ let%expect_test "%log_printbox" = - {| - BEGIN DEBUG SESSION - foo = () -- ├─"test/test_expect_test.ml":3480:21 -+ ├─"test/test_expect_test.ml":3485:21 - ├─0/0│0/1│0/2│0/3│0/4 - │ ───┼───┼───┼───┼─── - │ 1/0│1/1│1/2│1/3│1/4 -@@ -3567,7 +3567,7 @@ let%expect_test "%log_printbox flushing" = - [%expect - {| - BEGIN DEBUG SESSION -- foo begin "test/test_expect_test.ml":3542:21: -+ foo begin "test/test_expect_test.ml":3547:21: - 0/0│0/1│0/2│0/3│0/4 - ───┼───┼───┼───┼─── - 1/0│1/1│1/2│1/3│1/4 -@@ -3592,7 +3592,7 @@ let%expect_test "%log_printbox flushing" = - - - 4/0 4/1 4/2 4/3 4/4 -- bar begin "test/test_expect_test.ml":3551:12: -+ bar begin "test/test_expect_test.ml":3556:12: - "Now with a frame:" - ┌───┬───┬───┬───┬───┐ - │0/0│0/1│0/2│0/3│0/4│ -@@ -3652,7 +3652,7 @@ let%expect_test "%log_entry" = - [%expect - {| - BEGIN DEBUG SESSION -- "test/test_expect_test.ml":3611:17: _logging_logic -+ "test/test_expect_test.ml":3616:17: _logging_logic - ├─"preamble" - ├─header 1 - │ ├─"log 1" -@@ -3692,36 +3692,36 @@ let%expect_test "flame graph" = - print_endline output; - [%expect - {| --
-+
--
-+
--
-+
--
-+
--
-+
-- -
--
-+
--
-+
-- -
--
-+
--
-+
--
-+
--
-+
-- -
--
-+
--
-+
--
-+
-- -@@ -3796,31 +3796,31 @@ let%expect_test "flame graph reduced ToC" = - print_endline output; - [%expect - {| --
-+
--
-+
--
-+
--
-+
--
-+ -
--
-+
-- -
--
-+
--
-+
--
-+
--
-+ -
--
-+
--
-+
-- -@@ -3878,10 +3878,10 @@ let%expect_test "%debug_show skip module bindings" = - {| - BEGIN DEBUG SESSION - bar = 15 -- ├─"test/test_expect_test.ml":3861:21 -+ ├─"test/test_expect_test.ml":3866:21 - ├─x = 7 - └─y = 8 -- └─"test/test_expect_test.ml":3863:8 -+ └─"test/test_expect_test.ml":3868:8 - 15 - |}] - -@@ -3907,52 +3907,52 @@ let%expect_test "%track_l_show procedure runtime passing" = - [%expect - {| - BEGIN DEBUG SESSION foo-1 -- foo-1 foo begin "test/test_expect_test.ml":3888:23: -+ foo-1 foo begin "test/test_expect_test.ml":3893:23: - "inside foo" - foo-1 foo end - - BEGIN DEBUG SESSION foo-1 -- foo-1 () begin "test/test_expect_test.ml":3894:8: -+ foo-1 () begin "test/test_expect_test.ml":3899:8: - "inside bar" - foo-1 () end - - BEGIN DEBUG SESSION foo-2 -- foo-2 foo begin "test/test_expect_test.ml":3888:23: -+ foo-2 foo begin "test/test_expect_test.ml":3893:23: - "inside foo" - foo-2 foo end - - BEGIN DEBUG SESSION foo-2 -- foo-2 () begin "test/test_expect_test.ml":3894:8: -+ foo-2 () begin "test/test_expect_test.ml":3899:8: - "inside bar" - foo-2 () end - - BEGIN DEBUG SESSION foo-3 -- foo-3 foo begin "test/test_expect_test.ml":3888:23: -+ foo-3 foo begin "test/test_expect_test.ml":3893:23: - "inside foo" - foo-3 foo end - - BEGIN DEBUG SESSION foo-3 -- foo-3 () begin "test/test_expect_test.ml":3894:8: -+ foo-3 () begin "test/test_expect_test.ml":3899:8: - "inside bar" - foo-3 () end - - BEGIN DEBUG SESSION foo-4 -- foo-4 foo begin "test/test_expect_test.ml":3888:23: -+ foo-4 foo begin "test/test_expect_test.ml":3893:23: - "inside foo" - foo-4 foo end - - BEGIN DEBUG SESSION foo-4 -- foo-4 () begin "test/test_expect_test.ml":3894:8: -+ foo-4 () begin "test/test_expect_test.ml":3899:8: - "inside bar" - foo-4 () end - - BEGIN DEBUG SESSION foo-5 -- foo-5 foo begin "test/test_expect_test.ml":3888:23: -+ foo-5 foo begin "test/test_expect_test.ml":3893:23: - "inside foo" - foo-5 foo end - - BEGIN DEBUG SESSION foo-5 -- foo-5 () begin "test/test_expect_test.ml":3894:8: -+ foo-5 () begin "test/test_expect_test.ml":3899:8: - "inside bar" - foo-5 () end - |}] -@@ -4012,18 +4012,18 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = - ┌─────────┐ - │bar = 336│ - ├─────────┘ -- ├─"test/test_expect_test.ml":3991:21 -+ ├─"test/test_expect_test.ml":3996:21 - ├─first = 7 - ├─second = 42 - └─┬─────┐ - │y = 8│ - ├─────┘ -- └─"test/test_expect_test.ml":3992:8 -+ └─"test/test_expect_test.ml":3997:8 - 336 - ┌────────┐ - │(r1, r2)│ - ├────────┘ -- ├─"test/test_expect_test.ml":4001:17 -+ ├─"test/test_expect_test.ml":4006:17 - ├─┬─────────┐ - │ ││ - │ ├─────────┘ -@@ -4034,13 +4034,13 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = - └─┬────────────────┐ - │baz = (339, 109)│ - ├────────────────┘ -- ├─"test/test_expect_test.ml":3996:21 -+ ├─"test/test_expect_test.ml":4001:21 - ├─first = 7 - ├─second = 42 - ├─┬──────┐ - │ │(y, z)│ - │ ├──────┘ -- │ ├─"test/test_expect_test.ml":3997:8 -+ │ ├─"test/test_expect_test.ml":4002:8 - │ └─┬────────┐ - │ ││ - │ ├────────┘ -@@ -4051,7 +4051,7 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = - └─┬──────┐ - │(a, b)│ - ├──────┘ -- ├─"test/test_expect_test.ml":3998:8 -+ ├─"test/test_expect_test.ml":4003:8 - └─┬────────┐ - ││ - ├────────┘ diff --git a/index.mld b/index.mld index 0641b9b..facd508 100644 --- a/index.mld +++ b/index.mld @@ -201,9 +201,9 @@ The entry extension points vary along three axes: }{- [%track_] also logs: which [if], [match], [function] branch is taken, [for] and [while] loops, and all functions, including anonymous ones. }{- The prefix [%diagn_] means only generating logs for explicitly logged values, i.e. introduced by [[%log_entry]], [[%log ...]], [[%log_result ...]] and [[%log_printbox ...]] statements. }} -}{- Optional infixes [_rt_] and [_rtb_] add a first-class module argument to a function, and unpack it as [module Debug_runtime] for the scope of the function. -{ul {- [_rt_] uses the module type [Minidebug_runtime.Debug_runtime]. -}{- [_rtb_] uses the module type [Minidebug_runtime.PrintBox_runtime]. +}{- Optional infixes [_rt_] and [_l_]: +{ul {- [_rt_] adds a first-class module argument to a function, and unpacks it as [module Debug_runtime] for the scope of the function. +}{- [_l_] calls [_get_local_debug_runtime], and unpacks it for the scope of the function: [let module Debug_runtime = (val _get_local_debug_runtime ()) in ...]. }{- This functionality is "one use only": it applies only to the function the extension point is attached to. }} }{- Representation and printing mechanism: [_pp], [_show], recommended: [_sexp] @@ -489,7 +489,7 @@ The [%diagn_] extension points further restrict logging to explicit logs only. E At runtime, the level can be set via [Minidebug_runtime.debug ~log_level] or [Minidebug_runtime.debug_file ~log_level] at runtime creation, or via [Debug_runtime.log_level := ...] later on, also for the flushing backend. Check out the test suite {{: test/test_expect_test.ml#L2536} test_expect_test.ml:"%log runtime log levels while-loop"} for examples: {@ocaml[ - let%track_rtb_sexp result () : int = + let%track_rt_sexp result () : int = let i = ref 0 in let j = ref 0 in while !i < 6 do @@ -506,8 +506,8 @@ At runtime, the level can be set via [Minidebug_runtime.debug ~log_level] or [Mi print_endline @@ Int.to_string (result - (Minidebug_runtime.debug ~values_first_mode:true ~log_level:2 - ~global_prefix:"Warning" ()) + Minidebug_runtime.( + forget_printbox @@ debug ~values_first_mode:true ~log_level:2 ~global_prefix:"Warning" ()) ()); ... ]} @@ -1346,7 +1346,9 @@ For programs with threads or domains running concurrently, you need to ensure th We offer three helpers for dealing with multiple debug runtimes. There is an optional runtime instance-level setting [global_prefix], which adds the given information to all log headers coming from the instance. -There are extension points [%debug_lb_sexp], [%track_lb_sexp], [%debug_l_sexp], etc. They call a function [_get_local_printbox_debug_runtime ()], or [_get_local_debug_runtime ()] for the [_l_] variants, and unpack the argument as [module Debug_runtime] (in a function body). The feature helps using a runtime instance dedicated to a thread or domain, since for example [_get_local_debug_runtime] can retrieve the runtime using [Domain.DLS]. To avoid surprises, this feature only takes effect for directly annotated functions, and unpacks a [Debug_runtime] inside the function body, so that we get the appropriate runtime for the dynamic local scope. +There are extension points [%debug_l_sexp], [%track_l_sexp], etc. They call a function [_get_local_debug_runtime ()] and unpack the argument as [module Debug_runtime] (in a function body). The feature helps using a runtime instance dedicated to a thread or domain, since for example [_get_local_debug_runtime] can retrieve the runtime using [Domain.DLS]. To avoid surprises, this feature only takes effect for directly annotated functions, and unpacks a [Debug_runtime] inside the function body, so that we get the appropriate runtime for the dynamic local scope. + +NOTE: it's important to annotate functions that might be called from threads (spawned domains) using the [_l_] variants of extension points, e.g. [%debug_l_sexp] (not [%debug_sexp]!). For clearest output, should configure [_get_local_debug_runtime ()] to return the same runtime as the [Debug_runtime] module that is in a file-wide scope, when called from the main thread / main domain. Example from the test suite: @@ -1387,12 +1389,12 @@ Example from the test suite: |}] ]} -Another similar feature is the extension points [%debug_rtb_sexp], [%track_rtb_sexp] [%debug_rt_sexp], etc. They add a first-class module argument to a function, and unpack the argument as [module Debug_runtime]. At present, passing of the runtime instance to functions needs to be done manually. Note that only the function attached to the [_rt_] or [_rtb_] extension point is modified. +Another similar feature is the extension points [%debug_rt_sexp], [%track_rt_sexp], etc. They add a first-class module argument to a function, and unpack the argument as [module Debug_runtime]. At present, passing of the runtime instance to functions needs to be done manually. Note that only the function attached to the [_rt_] extension point is modified. Example from the test suite: {@ocaml[ - let%track_rtb_show foo l : int = + let%track_rt_show foo l : int = match (l : int list) with [] -> 7 | y :: _ -> y * 2 in let () = @@ -1401,7 +1403,7 @@ Example from the test suite: (Minidebug_runtime.debug ~global_prefix:"foo-1" ~values_first_mode:true ()) [ 7 ] in - let%track_rtb_show baz : int list -> int = function + let%track_rt_show baz : int list -> int = function | [] -> 7 | [ y ] -> y * 2 | [ y; z ] -> y + z @@ -1410,13 +1412,13 @@ Example from the test suite: let () = print_endline @@ Int.to_string @@ baz - (Minidebug_runtime.debug ~global_prefix:"baz-1" ~values_first_mode:true ()) + Minidebug_runtime.(forget_printbox @@ debug ~global_prefix:"baz-1" ~values_first_mode:true ()) [ 4 ] in let () = print_endline @@ Int.to_string @@ baz - (Minidebug_runtime.debug ~global_prefix:"baz-2" ~values_first_mode:true ()) + Minidebug_runtime.(forget_printbox @@ debug ~global_prefix:"baz-2" ~values_first_mode:true ()) [ 4; 5; 6 ] in [%expect diff --git a/ppx_minidebug.ml b/ppx_minidebug.ml index 2e0f380..6cc2c70 100644 --- a/ppx_minidebug.ml +++ b/ppx_minidebug.ml @@ -3,19 +3,9 @@ module A = Ast_builder.Default (* module H = Ast_helper *) type log_value = Sexp | Show | Pp +type toplevel_opt_arg = Nested | Toplevel_no_arg | Runtime_passing | Runtime_local -type toplevel_opt_arg = - | Nested - | Toplevel_no_arg - | Generic - | PrintBox - | Generic_local - | PrintBox_local - -let is_local_debug_runtime = function - | Generic_local | PrintBox_local -> true - | _ -> false - +let is_local_debug_runtime = function Runtime_local -> true | _ -> false let global_log_count = ref 0 type context = { @@ -588,34 +578,27 @@ let pass_runtime ?(always = false) toplevel_opt_arg exp = let loc = exp.pexp_loc in (* Only pass runtime to functions. *) match (always, toplevel_opt_arg, exp) with - | true, Generic, _ - | _, Generic, { pexp_desc = Pexp_newtype _ | Pexp_fun _ | Pexp_function _; _ } -> + | true, Runtime_passing, _ + | _, Runtime_passing, { pexp_desc = Pexp_newtype _ | Pexp_fun _ | Pexp_function _; _ } + -> [%expr fun (_debug_runtime : (module Minidebug_runtime.Debug_runtime)) -> [%e exp]] - | true, PrintBox, _ - | _, PrintBox, { pexp_desc = Pexp_newtype _ | Pexp_fun _ | Pexp_function _; _ } -> - [%expr - fun (_debug_runtime : (module Minidebug_runtime.PrintBox_runtime)) -> [%e exp]] | _ -> exp let unpack_runtime toplevel_opt_arg exp = let loc = exp.pexp_loc in match toplevel_opt_arg with | Nested | Toplevel_no_arg -> exp - | Generic_local -> + | Runtime_local -> [%expr let module Debug_runtime = (val _get_local_debug_runtime ()) in [%e exp]] - | PrintBox_local -> - [%expr - let module Debug_runtime = (val _get_local_printbox_debug_runtime ()) in - [%e exp]] - | Generic | PrintBox -> + | Runtime_passing -> [%expr let module Debug_runtime = (val _debug_runtime) in [%e exp]] let has_runtime_arg = function - | { toplevel_opt_arg = PrintBox | Generic; _ } -> true + | { toplevel_opt_arg = Runtime_passing; _ } -> true | _ -> false let loc_to_name loc = @@ -752,29 +735,21 @@ let debug_function ?unpack_context context callback ~loc ?ret_descr ?ret_typ ?ar cases) in match context.toplevel_opt_arg with - | Nested | Toplevel_no_arg | Generic_local | PrintBox_local -> exp - | Generic -> + | Nested | Toplevel_no_arg | Runtime_local -> exp + | Runtime_passing -> [%expr fun (_debug_runtime : (module Minidebug_runtime.Debug_runtime)) -> let module Debug_runtime = (val _debug_runtime) in [%e exp]] - | PrintBox -> - [%expr - fun (_debug_runtime : (module Minidebug_runtime.PrintBox_runtime)) -> - let module Debug_runtime = (val _debug_runtime) in - [%e exp]] let debug_binding context callback vb = let nested = { context with toplevel_opt_arg = Nested } in let pvb_pat = (* FIXME(#18): restoring a modified type constraint breaks typing. *) match (vb.pvb_pat, context.toplevel_opt_arg) with - | [%pat? ([%p? pat] : [%t? _typ])], Generic -> + | [%pat? ([%p? pat] : [%t? _typ])], Runtime_passing -> pat (* [%pat? ([%p pat] : (module Minidebug_runtime.Debug_runtime) -> [%t typ])] *) - | [%pat? ([%p? pat] : [%t? _typ])], PrintBox -> - pat - (* [%pat? ([%p pat] : (module Minidebug_runtime.PrintBox_runtime) -> [%t typ])] *) | _ -> vb.pvb_pat in if context.comptime_log_level <= 0 then @@ -849,17 +824,13 @@ let debug_binding context callback vb = in let pvb_expr = match (typ2, context.toplevel_opt_arg) with - | None, (Nested | Toplevel_no_arg | Generic_local | PrintBox_local) -> exp - | Some typ, (Nested | Toplevel_no_arg | Generic_local | PrintBox_local) -> + | None, (Nested | Toplevel_no_arg | Runtime_local) -> exp + | Some typ, (Nested | Toplevel_no_arg | Runtime_local) -> [%expr ([%e exp] : [%t typ])] - | Some typ, Generic -> + | Some typ, Runtime_passing -> [%expr ([%e exp] : (module Minidebug_runtime.Debug_runtime) -> [%t typ])] - | Some typ, PrintBox -> - [%expr ([%e exp] : (module Minidebug_runtime.PrintBox_runtime) -> [%t typ])] - | None, Generic -> + | None, Runtime_passing -> [%expr ([%e exp] : (module Minidebug_runtime.Debug_runtime) -> _)] - | None, PrintBox -> - [%expr ([%e exp] : (module Minidebug_runtime.PrintBox_runtime) -> _)] in { vb with pvb_expr; pvb_pat } @@ -1010,10 +981,8 @@ let rules = match toplevel_opt_arg with | Nested -> assert false | Toplevel_no_arg -> ext_point - | Generic -> ext_point ^ "_rt" - | PrintBox -> ext_point ^ "_rtb" - | Generic_local -> ext_point ^ "_l" - | PrintBox_local -> ext_point ^ "_lb" + | Runtime_passing -> ext_point ^ "_rt" + | Runtime_local -> ext_point ^ "_l" in let ext_point = ext_point ^ "_" @@ -1034,7 +1003,7 @@ let rules = }) [ Pp; Sexp; Show ]) [ `Debug; `Str ]) - [ Toplevel_no_arg; Generic; PrintBox; Generic_local; PrintBox_local ]) + [ Toplevel_no_arg; Runtime_passing; Runtime_local ]) [ 0; 1; 2; 3; 4; 5; 6; 7; 8; 9 ]) [ `Track; `Debug; `Diagn ] @@ -1391,8 +1360,7 @@ let traverse_expression = match ret_typ with None -> exp | Some typ -> [%expr ([%e exp] : [%t typ])] in match (unpacked_runtime, context.toplevel_opt_arg) with - | true, (PrintBox | Generic) -> - pass_runtime ~always:true context.toplevel_opt_arg exp + | true, Runtime_passing -> pass_runtime ~always:true context.toplevel_opt_arg exp | _ -> exp method! structure_item context si = diff --git a/test/test_expect_test.ml b/test/test_expect_test.ml index 1b6223c..6009a79 100644 --- a/test/test_expect_test.ml +++ b/test/test_expect_test.ml @@ -2280,17 +2280,16 @@ let%expect_test "%track_show list values_first_mode" = 10 |}] -let%expect_test "%track_rtb_show list runtime passing" = - let%track_rtb_show foo l : int = - match (l : int list) with [] -> 7 | y :: _ -> y * 2 - in +let%expect_test "%track_rt_show list runtime passing" = + let%track_rt_show foo l : int = match (l : int list) with [] -> 7 | y :: _ -> y * 2 in let () = print_endline @@ Int.to_string @@ foo - (Minidebug_runtime.debug ~global_prefix:"foo-1" ~values_first_mode:true ()) + Minidebug_runtime.( + forget_printbox @@ debug ~global_prefix:"foo-1" ~values_first_mode:true ()) [ 7 ] in - let%track_rtb_show baz : int list -> int = function + let%track_rt_show baz : int list -> int = function | [] -> 7 | [ y ] -> y * 2 | [ y; z ] -> y + z @@ -2299,35 +2298,37 @@ let%expect_test "%track_rtb_show list runtime passing" = let () = print_endline @@ Int.to_string @@ baz - (Minidebug_runtime.debug ~global_prefix:"baz-1" ~values_first_mode:true ()) + Minidebug_runtime.( + forget_printbox @@ debug ~global_prefix:"baz-1" ~values_first_mode:true ()) [ 4 ] in let () = print_endline @@ Int.to_string @@ baz - (Minidebug_runtime.debug ~global_prefix:"baz-2" ~values_first_mode:true ()) + Minidebug_runtime.( + forget_printbox @@ debug ~global_prefix:"baz-2" ~values_first_mode:true ()) [ 4; 5; 6 ] in [%expect {| BEGIN DEBUG SESSION foo-1 foo = 14 - ├─"test/test_expect_test.ml":2284:25 + ├─"test/test_expect_test.ml":2284:24 └─foo-1 :: (y, _) - ├─"test/test_expect_test.ml":2285:50 + ├─"test/test_expect_test.ml":2284:80 └─y = 7 14 BEGIN DEBUG SESSION baz-1 baz = 8 - ├─"test/test_expect_test.ml":2295:15 + ├─"test/test_expect_test.ml":2294:15 ├─baz-1 :: (y, []) └─y = 4 8 BEGIN DEBUG SESSION baz-2 baz = 10 - ├─"test/test_expect_test.ml":2297:21 + ├─"test/test_expect_test.ml":2296:21 ├─baz-2 :: (y, :: (z, _)) ├─y = 4 └─z = 5 @@ -2347,23 +2348,23 @@ let%expect_test "%track_rt_show procedure runtime passing" = [%expect {| BEGIN DEBUG SESSION bar-1 - bar-1 bar begin "test/test_expect_test.ml":2338:24: - bar-1 fun:test_expect_test:2338 begin "test/test_expect_test.ml":2338:29: - bar-1 fun:test_expect_test:2338 end + bar-1 bar begin "test/test_expect_test.ml":2339:24: + bar-1 fun:test_expect_test:2339 begin "test/test_expect_test.ml":2339:29: + bar-1 fun:test_expect_test:2339 end bar-1 bar end BEGIN DEBUG SESSION bar-2 - bar-2 bar begin "test/test_expect_test.ml":2338:24: - bar-2 fun:test_expect_test:2338 begin "test/test_expect_test.ml":2338:29: - bar-2 fun:test_expect_test:2338 end + bar-2 bar begin "test/test_expect_test.ml":2339:24: + bar-2 fun:test_expect_test:2339 begin "test/test_expect_test.ml":2339:29: + bar-2 fun:test_expect_test:2339 end bar-2 bar end BEGIN DEBUG SESSION foo-1 - foo-1 foo begin "test/test_expect_test.ml":2341:24: + foo-1 foo begin "test/test_expect_test.ml":2342:24: foo-1 foo end BEGIN DEBUG SESSION foo-2 - foo-2 foo begin "test/test_expect_test.ml":2341:24: + foo-2 foo begin "test/test_expect_test.ml":2342:24: foo-2 foo end |}] @@ -2386,26 +2387,26 @@ let%expect_test "%track_rt_show nested procedure runtime passing" = {| BEGIN DEBUG SESSION rt_test - └─"test/test_expect_test.ml":2372:25 + └─"test/test_expect_test.ml":2373:25 BEGIN DEBUG SESSION foo-1 - foo-1 foo begin "test/test_expect_test.ml":2374:26: + foo-1 foo begin "test/test_expect_test.ml":2375:26: foo-1 foo end BEGIN DEBUG SESSION foo-2 - foo-2 foo begin "test/test_expect_test.ml":2374:26: + foo-2 foo begin "test/test_expect_test.ml":2375:26: foo-2 foo end BEGIN DEBUG SESSION bar-1 - bar-1 bar begin "test/test_expect_test.ml":2373:26: - bar-1 fun:test_expect_test:2373 begin "test/test_expect_test.ml":2373:31: - bar-1 fun:test_expect_test:2373 end + bar-1 bar begin "test/test_expect_test.ml":2374:26: + bar-1 fun:test_expect_test:2374 begin "test/test_expect_test.ml":2374:31: + bar-1 fun:test_expect_test:2374 end bar-1 bar end BEGIN DEBUG SESSION bar-2 - bar-2 bar begin "test/test_expect_test.ml":2373:26: - bar-2 fun:test_expect_test:2373 begin "test/test_expect_test.ml":2373:31: - bar-2 fun:test_expect_test:2373 end + bar-2 bar begin "test/test_expect_test.ml":2374:26: + bar-2 fun:test_expect_test:2374 begin "test/test_expect_test.ml":2374:31: + bar-2 fun:test_expect_test:2374 end bar-2 bar end |}] @@ -2428,12 +2429,12 @@ let%expect_test "%log constant entries" = {| BEGIN DEBUG SESSION foo = () - ├─"test/test_expect_test.ml":2414:21 + ├─"test/test_expect_test.ml":2415:21 ├─"This is the first log line" ├─["This is the"; "2"; "log line"] └─("This is the", 3, "or", 3.14, "log line") bar - ├─"test/test_expect_test.ml":2421:21 + ├─"test/test_expect_test.ml":2422:21 ├─This is the first log line ├─This is the │ ├─2 @@ -2462,7 +2463,7 @@ let%expect_test "%log with type annotations" = {| BEGIN DEBUG SESSION foo = () - ├─"test/test_expect_test.ml":2453:21 + ├─"test/test_expect_test.ml":2454:21 ├─("This is like", 3, "or", 3.14, "above") ├─("tau =", 6.28) ├─[4; 1; 2; 3] @@ -2490,7 +2491,7 @@ let%expect_test "%log with default type assumption" = {| BEGIN DEBUG SESSION foo = () - ├─"test/test_expect_test.ml":2479:21 + ├─"test/test_expect_test.ml":2480:21 ├─"2*3" ├─("This is like", "3", "or", "3.14", "above") ├─("tau =", "2*3.14") @@ -2515,29 +2516,29 @@ let%expect_test "%log track while-loop" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":2502:17: result - └─"test/test_expect_test.ml":2505:4: while:test_expect_test:2505 - ├─"test/test_expect_test.ml":2506:6: + "test/test_expect_test.ml":2503:17: result + └─"test/test_expect_test.ml":2506:4: while:test_expect_test:2506 + ├─"test/test_expect_test.ml":2507:6: │ ├─(1 i= 0) │ ├─(2 i= 1) │ └─(3 j= 1) - ├─"test/test_expect_test.ml":2506:6: + ├─"test/test_expect_test.ml":2507:6: │ ├─(1 i= 1) │ ├─(2 i= 2) │ └─(3 j= 3) - ├─"test/test_expect_test.ml":2506:6: + ├─"test/test_expect_test.ml":2507:6: │ ├─(1 i= 2) │ ├─(2 i= 3) │ └─(3 j= 6) - ├─"test/test_expect_test.ml":2506:6: + ├─"test/test_expect_test.ml":2507:6: │ ├─(1 i= 3) │ ├─(2 i= 4) │ └─(3 j= 10) - ├─"test/test_expect_test.ml":2506:6: + ├─"test/test_expect_test.ml":2507:6: │ ├─(1 i= 4) │ ├─(2 i= 5) │ └─(3 j= 15) - └─"test/test_expect_test.ml":2506:6: + └─"test/test_expect_test.ml":2507:6: ├─(1 i= 5) ├─(2 i= 6) └─(3 j= 21) @@ -2545,7 +2546,7 @@ let%expect_test "%log track while-loop" = |}] let%expect_test "%log runtime log levels while-loop" = - let%track_rtb_sexp result () : int = + let%track_rt_sexp result () : int = let i = ref 0 in let j = ref 0 in while !i < 6 do @@ -2559,61 +2560,67 @@ let%expect_test "%log runtime log levels while-loop" = !j in print_endline - @@ Int.to_string (result (Minidebug_runtime.debug ~global_prefix:"Everything" ()) ()); + @@ Int.to_string + (result + Minidebug_runtime.(forget_printbox @@ debug ~global_prefix:"Everything" ()) + ()); print_endline @@ Int.to_string (result - (Minidebug_runtime.debug ~values_first_mode:true ~log_level:0 - ~global_prefix:"Nothing" ()) + Minidebug_runtime.( + forget_printbox + @@ debug ~values_first_mode:true ~log_level:0 ~global_prefix:"Nothing" ()) ()); print_endline @@ Int.to_string (result - (Minidebug_runtime.debug ~values_first_mode:true ~log_level:1 - ~global_prefix:"Error" ()) + Minidebug_runtime.( + forget_printbox + @@ debug ~values_first_mode:true ~log_level:1 ~global_prefix:"Error" ()) ()); print_endline @@ Int.to_string (result - (Minidebug_runtime.debug ~values_first_mode:true ~log_level:2 - ~global_prefix:"Warning" ()) + Minidebug_runtime.( + forget_printbox + @@ debug ~values_first_mode:true ~log_level:2 ~global_prefix:"Warning" ()) ()); [%expect {| BEGIN DEBUG SESSION Everything - "test/test_expect_test.ml":2548:28: Everything result - ├─"test/test_expect_test.ml":2551:4: Everything while:test_expect_test:2551 - │ ├─"test/test_expect_test.ml":2553:6: Everything - │ │ ├─"test/test_expect_test.ml":2553:21: Everything then:test_expect_test:2553 + "test/test_expect_test.ml":2549:27: Everything result + ├─"test/test_expect_test.ml":2552:4: Everything while:test_expect_test:2552 + │ ├─"test/test_expect_test.ml":2554:6: Everything + │ │ ├─"test/test_expect_test.ml":2554:21: Everything then:test_expect_test:2554 │ │ │ └─(ERROR: 1 i= 0) │ │ ├─(WARNING: 2 i= 1) - │ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 + │ │ ├─"test/test_expect_test.ml":2557:11: Everything fun:test_expect_test:2557 │ │ └─(INFO: 3 j= 1) - │ ├─"test/test_expect_test.ml":2553:6: Everything - │ │ ├─"test/test_expect_test.ml":2553:21: Everything then:test_expect_test:2553 + │ ├─"test/test_expect_test.ml":2554:6: Everything + │ │ ├─"test/test_expect_test.ml":2554:21: Everything then:test_expect_test:2554 │ │ │ └─(ERROR: 1 i= 1) │ │ ├─(WARNING: 2 i= 2) - │ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 + │ │ ├─"test/test_expect_test.ml":2557:11: Everything fun:test_expect_test:2557 │ │ └─(INFO: 3 j= 3) - │ ├─"test/test_expect_test.ml":2553:6: Everything - │ │ ├─"test/test_expect_test.ml":2553:64: Everything else:test_expect_test:2553 + │ ├─"test/test_expect_test.ml":2554:6: Everything + │ │ ├─"test/test_expect_test.ml":2554:64: Everything else:test_expect_test:2554 │ │ ├─(WARNING: 2 i= 3) - │ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 + │ │ ├─"test/test_expect_test.ml":2557:11: Everything fun:test_expect_test:2557 │ │ └─(INFO: 3 j= 6) - │ ├─"test/test_expect_test.ml":2553:6: Everything - │ │ ├─"test/test_expect_test.ml":2553:64: Everything else:test_expect_test:2553 + │ ├─"test/test_expect_test.ml":2554:6: Everything + │ │ ├─"test/test_expect_test.ml":2554:64: Everything else:test_expect_test:2554 │ │ ├─(WARNING: 2 i= 4) - │ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 + │ │ ├─"test/test_expect_test.ml":2557:11: Everything fun:test_expect_test:2557 │ │ └─(INFO: 3 j= 10) - │ ├─"test/test_expect_test.ml":2553:6: Everything - │ │ ├─"test/test_expect_test.ml":2553:64: Everything else:test_expect_test:2553 + │ ├─"test/test_expect_test.ml":2554:6: Everything + │ │ ├─"test/test_expect_test.ml":2554:64: Everything else:test_expect_test:2554 │ │ ├─(WARNING: 2 i= 5) - │ │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 + │ │ ├─"test/test_expect_test.ml":2557:11: Everything fun:test_expect_test:2557 │ │ └─(INFO: 3 j= 15) - │ └─"test/test_expect_test.ml":2553:6: Everything - │ ├─"test/test_expect_test.ml":2553:64: Everything else:test_expect_test:2553 + │ └─"test/test_expect_test.ml":2554:6: Everything + │ ├─"test/test_expect_test.ml":2554:64: Everything else:test_expect_test:2554 │ ├─(WARNING: 2 i= 6) - │ ├─"test/test_expect_test.ml":2556:11: Everything fun:test_expect_test:2556 + │ ├─"test/test_expect_test.ml":2557:11: Everything fun:test_expect_test:2557 │ └─(INFO: 3 j= 21) └─result = 21 21 @@ -2623,98 +2630,98 @@ let%expect_test "%log runtime log levels while-loop" = BEGIN DEBUG SESSION Error result = 21 - ├─"test/test_expect_test.ml":2548:28 - └─Error while:test_expect_test:2551 - ├─"test/test_expect_test.ml":2551:4 + ├─"test/test_expect_test.ml":2549:27 + └─Error while:test_expect_test:2552 + ├─"test/test_expect_test.ml":2552:4 ├─Error - │ ├─"test/test_expect_test.ml":2553:6 - │ ├─Error then:test_expect_test:2553 - │ │ ├─"test/test_expect_test.ml":2553:21 + │ ├─"test/test_expect_test.ml":2554:6 + │ ├─Error then:test_expect_test:2554 + │ │ ├─"test/test_expect_test.ml":2554:21 │ │ └─(ERROR: 1 i= 0) - │ └─Error fun:test_expect_test:2556 - │ └─"test/test_expect_test.ml":2556:11 + │ └─Error fun:test_expect_test:2557 + │ └─"test/test_expect_test.ml":2557:11 ├─Error - │ ├─"test/test_expect_test.ml":2553:6 - │ ├─Error then:test_expect_test:2553 - │ │ ├─"test/test_expect_test.ml":2553:21 + │ ├─"test/test_expect_test.ml":2554:6 + │ ├─Error then:test_expect_test:2554 + │ │ ├─"test/test_expect_test.ml":2554:21 │ │ └─(ERROR: 1 i= 1) - │ └─Error fun:test_expect_test:2556 - │ └─"test/test_expect_test.ml":2556:11 + │ └─Error fun:test_expect_test:2557 + │ └─"test/test_expect_test.ml":2557:11 ├─Error - │ ├─"test/test_expect_test.ml":2553:6 - │ ├─Error else:test_expect_test:2553 - │ │ └─"test/test_expect_test.ml":2553:64 - │ └─Error fun:test_expect_test:2556 - │ └─"test/test_expect_test.ml":2556:11 + │ ├─"test/test_expect_test.ml":2554:6 + │ ├─Error else:test_expect_test:2554 + │ │ └─"test/test_expect_test.ml":2554:64 + │ └─Error fun:test_expect_test:2557 + │ └─"test/test_expect_test.ml":2557:11 ├─Error - │ ├─"test/test_expect_test.ml":2553:6 - │ ├─Error else:test_expect_test:2553 - │ │ └─"test/test_expect_test.ml":2553:64 - │ └─Error fun:test_expect_test:2556 - │ └─"test/test_expect_test.ml":2556:11 + │ ├─"test/test_expect_test.ml":2554:6 + │ ├─Error else:test_expect_test:2554 + │ │ └─"test/test_expect_test.ml":2554:64 + │ └─Error fun:test_expect_test:2557 + │ └─"test/test_expect_test.ml":2557:11 ├─Error - │ ├─"test/test_expect_test.ml":2553:6 - │ ├─Error else:test_expect_test:2553 - │ │ └─"test/test_expect_test.ml":2553:64 - │ └─Error fun:test_expect_test:2556 - │ └─"test/test_expect_test.ml":2556:11 + │ ├─"test/test_expect_test.ml":2554:6 + │ ├─Error else:test_expect_test:2554 + │ │ └─"test/test_expect_test.ml":2554:64 + │ └─Error fun:test_expect_test:2557 + │ └─"test/test_expect_test.ml":2557:11 └─Error - ├─"test/test_expect_test.ml":2553:6 - ├─Error else:test_expect_test:2553 - │ └─"test/test_expect_test.ml":2553:64 - └─Error fun:test_expect_test:2556 - └─"test/test_expect_test.ml":2556:11 + ├─"test/test_expect_test.ml":2554:6 + ├─Error else:test_expect_test:2554 + │ └─"test/test_expect_test.ml":2554:64 + └─Error fun:test_expect_test:2557 + └─"test/test_expect_test.ml":2557:11 21 BEGIN DEBUG SESSION Warning result = 21 - ├─"test/test_expect_test.ml":2548:28 - └─Warning while:test_expect_test:2551 - ├─"test/test_expect_test.ml":2551:4 + ├─"test/test_expect_test.ml":2549:27 + └─Warning while:test_expect_test:2552 + ├─"test/test_expect_test.ml":2552:4 ├─Warning - │ ├─"test/test_expect_test.ml":2553:6 - │ ├─Warning then:test_expect_test:2553 - │ │ ├─"test/test_expect_test.ml":2553:21 + │ ├─"test/test_expect_test.ml":2554:6 + │ ├─Warning then:test_expect_test:2554 + │ │ ├─"test/test_expect_test.ml":2554:21 │ │ └─(ERROR: 1 i= 0) │ ├─(WARNING: 2 i= 1) - │ └─Warning fun:test_expect_test:2556 - │ └─"test/test_expect_test.ml":2556:11 + │ └─Warning fun:test_expect_test:2557 + │ └─"test/test_expect_test.ml":2557:11 ├─Warning - │ ├─"test/test_expect_test.ml":2553:6 - │ ├─Warning then:test_expect_test:2553 - │ │ ├─"test/test_expect_test.ml":2553:21 + │ ├─"test/test_expect_test.ml":2554:6 + │ ├─Warning then:test_expect_test:2554 + │ │ ├─"test/test_expect_test.ml":2554:21 │ │ └─(ERROR: 1 i= 1) │ ├─(WARNING: 2 i= 2) - │ └─Warning fun:test_expect_test:2556 - │ └─"test/test_expect_test.ml":2556:11 + │ └─Warning fun:test_expect_test:2557 + │ └─"test/test_expect_test.ml":2557:11 ├─Warning - │ ├─"test/test_expect_test.ml":2553:6 - │ ├─Warning else:test_expect_test:2553 - │ │ └─"test/test_expect_test.ml":2553:64 + │ ├─"test/test_expect_test.ml":2554:6 + │ ├─Warning else:test_expect_test:2554 + │ │ └─"test/test_expect_test.ml":2554:64 │ ├─(WARNING: 2 i= 3) - │ └─Warning fun:test_expect_test:2556 - │ └─"test/test_expect_test.ml":2556:11 + │ └─Warning fun:test_expect_test:2557 + │ └─"test/test_expect_test.ml":2557:11 ├─Warning - │ ├─"test/test_expect_test.ml":2553:6 - │ ├─Warning else:test_expect_test:2553 - │ │ └─"test/test_expect_test.ml":2553:64 + │ ├─"test/test_expect_test.ml":2554:6 + │ ├─Warning else:test_expect_test:2554 + │ │ └─"test/test_expect_test.ml":2554:64 │ ├─(WARNING: 2 i= 4) - │ └─Warning fun:test_expect_test:2556 - │ └─"test/test_expect_test.ml":2556:11 + │ └─Warning fun:test_expect_test:2557 + │ └─"test/test_expect_test.ml":2557:11 ├─Warning - │ ├─"test/test_expect_test.ml":2553:6 - │ ├─Warning else:test_expect_test:2553 - │ │ └─"test/test_expect_test.ml":2553:64 + │ ├─"test/test_expect_test.ml":2554:6 + │ ├─Warning else:test_expect_test:2554 + │ │ └─"test/test_expect_test.ml":2554:64 │ ├─(WARNING: 2 i= 5) - │ └─Warning fun:test_expect_test:2556 - │ └─"test/test_expect_test.ml":2556:11 + │ └─Warning fun:test_expect_test:2557 + │ └─"test/test_expect_test.ml":2557:11 └─Warning - ├─"test/test_expect_test.ml":2553:6 - ├─Warning else:test_expect_test:2553 - │ └─"test/test_expect_test.ml":2553:64 + ├─"test/test_expect_test.ml":2554:6 + ├─Warning else:test_expect_test:2554 + │ └─"test/test_expect_test.ml":2554:64 ├─(WARNING: 2 i= 6) - └─Warning fun:test_expect_test:2556 - └─"test/test_expect_test.ml":2556:11 + └─Warning fun:test_expect_test:2557 + └─"test/test_expect_test.ml":2557:11 21 |}] @@ -2773,98 +2780,98 @@ let%expect_test "%log compile time log levels while-loop" = {| BEGIN DEBUG SESSION everything = 21 - ├─"test/test_expect_test.ml":2723:28 - └─while:test_expect_test:2728 - ├─"test/test_expect_test.ml":2728:6 + ├─"test/test_expect_test.ml":2730:28 + └─while:test_expect_test:2735 + ├─"test/test_expect_test.ml":2735:6 ├─ - │ ├─"test/test_expect_test.ml":2730:8 - │ ├─then:test_expect_test:2730 - │ │ ├─"test/test_expect_test.ml":2730:23 + │ ├─"test/test_expect_test.ml":2737:8 + │ ├─then:test_expect_test:2737 + │ │ ├─"test/test_expect_test.ml":2737:23 │ │ └─(ERROR: 1 i= 0) │ ├─(WARNING: 2 i= 1) - │ ├─fun:test_expect_test:2733 - │ │ └─"test/test_expect_test.ml":2733:13 + │ ├─fun:test_expect_test:2740 + │ │ └─"test/test_expect_test.ml":2740:13 │ └─(INFO: 3 j= 1) ├─ - │ ├─"test/test_expect_test.ml":2730:8 - │ ├─then:test_expect_test:2730 - │ │ ├─"test/test_expect_test.ml":2730:23 + │ ├─"test/test_expect_test.ml":2737:8 + │ ├─then:test_expect_test:2737 + │ │ ├─"test/test_expect_test.ml":2737:23 │ │ └─(ERROR: 1 i= 1) │ ├─(WARNING: 2 i= 2) - │ ├─fun:test_expect_test:2733 - │ │ └─"test/test_expect_test.ml":2733:13 + │ ├─fun:test_expect_test:2740 + │ │ └─"test/test_expect_test.ml":2740:13 │ └─(INFO: 3 j= 3) ├─ - │ ├─"test/test_expect_test.ml":2730:8 - │ ├─else:test_expect_test:2730 - │ │ └─"test/test_expect_test.ml":2730:66 + │ ├─"test/test_expect_test.ml":2737:8 + │ ├─else:test_expect_test:2737 + │ │ └─"test/test_expect_test.ml":2737:66 │ ├─(WARNING: 2 i= 3) - │ ├─fun:test_expect_test:2733 - │ │ └─"test/test_expect_test.ml":2733:13 + │ ├─fun:test_expect_test:2740 + │ │ └─"test/test_expect_test.ml":2740:13 │ └─(INFO: 3 j= 6) ├─ - │ ├─"test/test_expect_test.ml":2730:8 - │ ├─else:test_expect_test:2730 - │ │ └─"test/test_expect_test.ml":2730:66 + │ ├─"test/test_expect_test.ml":2737:8 + │ ├─else:test_expect_test:2737 + │ │ └─"test/test_expect_test.ml":2737:66 │ ├─(WARNING: 2 i= 4) - │ ├─fun:test_expect_test:2733 - │ │ └─"test/test_expect_test.ml":2733:13 + │ ├─fun:test_expect_test:2740 + │ │ └─"test/test_expect_test.ml":2740:13 │ └─(INFO: 3 j= 10) ├─ - │ ├─"test/test_expect_test.ml":2730:8 - │ ├─else:test_expect_test:2730 - │ │ └─"test/test_expect_test.ml":2730:66 + │ ├─"test/test_expect_test.ml":2737:8 + │ ├─else:test_expect_test:2737 + │ │ └─"test/test_expect_test.ml":2737:66 │ ├─(WARNING: 2 i= 5) - │ ├─fun:test_expect_test:2733 - │ │ └─"test/test_expect_test.ml":2733:13 + │ ├─fun:test_expect_test:2740 + │ │ └─"test/test_expect_test.ml":2740:13 │ └─(INFO: 3 j= 15) └─ - ├─"test/test_expect_test.ml":2730:8 - ├─else:test_expect_test:2730 - │ └─"test/test_expect_test.ml":2730:66 + ├─"test/test_expect_test.ml":2737:8 + ├─else:test_expect_test:2737 + │ └─"test/test_expect_test.ml":2737:66 ├─(WARNING: 2 i= 6) - ├─fun:test_expect_test:2733 - │ └─"test/test_expect_test.ml":2733:13 + ├─fun:test_expect_test:2740 + │ └─"test/test_expect_test.ml":2740:13 └─(INFO: 3 j= 21) 21 nothing = 21 - └─"test/test_expect_test.ml":2738:25 + └─"test/test_expect_test.ml":2745:25 21 warning = 21 - ├─"test/test_expect_test.ml":2754:25 - └─while:test_expect_test:2759 - ├─"test/test_expect_test.ml":2759:6 + ├─"test/test_expect_test.ml":2761:25 + └─while:test_expect_test:2766 + ├─"test/test_expect_test.ml":2766:6 ├─ - │ ├─"test/test_expect_test.ml":2761:8 - │ ├─then:test_expect_test:2761 - │ │ ├─"test/test_expect_test.ml":2761:23 + │ ├─"test/test_expect_test.ml":2768:8 + │ ├─then:test_expect_test:2768 + │ │ ├─"test/test_expect_test.ml":2768:23 │ │ └─(ERROR: 1 i= 0) │ └─(WARNING: 2 i= 1) ├─ - │ ├─"test/test_expect_test.ml":2761:8 - │ ├─then:test_expect_test:2761 - │ │ ├─"test/test_expect_test.ml":2761:23 + │ ├─"test/test_expect_test.ml":2768:8 + │ ├─then:test_expect_test:2768 + │ │ ├─"test/test_expect_test.ml":2768:23 │ │ └─(ERROR: 1 i= 1) │ └─(WARNING: 2 i= 2) ├─ - │ ├─"test/test_expect_test.ml":2761:8 - │ ├─else:test_expect_test:2761 - │ │ └─"test/test_expect_test.ml":2761:66 + │ ├─"test/test_expect_test.ml":2768:8 + │ ├─else:test_expect_test:2768 + │ │ └─"test/test_expect_test.ml":2768:66 │ └─(WARNING: 2 i= 3) ├─ - │ ├─"test/test_expect_test.ml":2761:8 - │ ├─else:test_expect_test:2761 - │ │ └─"test/test_expect_test.ml":2761:66 + │ ├─"test/test_expect_test.ml":2768:8 + │ ├─else:test_expect_test:2768 + │ │ └─"test/test_expect_test.ml":2768:66 │ └─(WARNING: 2 i= 4) ├─ - │ ├─"test/test_expect_test.ml":2761:8 - │ ├─else:test_expect_test:2761 - │ │ └─"test/test_expect_test.ml":2761:66 + │ ├─"test/test_expect_test.ml":2768:8 + │ ├─else:test_expect_test:2768 + │ │ └─"test/test_expect_test.ml":2768:66 │ └─(WARNING: 2 i= 5) └─ - ├─"test/test_expect_test.ml":2761:8 - ├─else:test_expect_test:2761 - │ └─"test/test_expect_test.ml":2761:66 + ├─"test/test_expect_test.ml":2768:8 + ├─else:test_expect_test:2768 + │ └─"test/test_expect_test.ml":2768:66 └─(WARNING: 2 i= 6) 21 |}] @@ -2878,7 +2885,7 @@ let%expect_test "%log compile time log levels runtime-passing while-loop" = let%debug_sexp () = ([%log_level 0; - let%track_rtb_sexp nothing () : int = + let%track_rt_sexp nothing () : int = let i = ref 0 in let j = ref 0 in while !i < 6 do @@ -2893,11 +2900,12 @@ let%expect_test "%log compile time log levels runtime-passing while-loop" = in print_endline @@ Int.to_string @@ nothing - (Minidebug_runtime.debug ~global_prefix:"nothing" ~values_first_mode:true ()) + Minidebug_runtime.( + forget_printbox @@ debug ~global_prefix:"nothing" ~values_first_mode:true ()) ()]); [%log_level 2; - let%track_rtb_sexp warning () : int = + let%track_rt_sexp warning () : int = let i = ref 0 in let j = ref 0 in while !i < 6 do @@ -2912,7 +2920,8 @@ let%expect_test "%log compile time log levels runtime-passing while-loop" = in print_endline @@ Int.to_string @@ warning - (Minidebug_runtime.debug ~global_prefix:"warning" ~values_first_mode:true ()) + Minidebug_runtime.( + forget_printbox @@ debug ~global_prefix:"warning" ~values_first_mode:true ()) ()] in [%expect @@ -2924,44 +2933,44 @@ let%expect_test "%log compile time log levels runtime-passing while-loop" = BEGIN DEBUG SESSION warning warning = 21 - ├─"test/test_expect_test.ml":2900:33 - └─warning while:test_expect_test:2903 - ├─"test/test_expect_test.ml":2903:8 + ├─"test/test_expect_test.ml":2908:32 + └─warning while:test_expect_test:2911 + ├─"test/test_expect_test.ml":2911:8 ├─warning - │ ├─"test/test_expect_test.ml":2905:10 - │ ├─warning then:test_expect_test:2905 - │ │ ├─"test/test_expect_test.ml":2905:25 + │ ├─"test/test_expect_test.ml":2913:10 + │ ├─warning then:test_expect_test:2913 + │ │ ├─"test/test_expect_test.ml":2913:25 │ │ └─(ERROR: 1 i= 0) │ └─(WARNING: 2 i= 1) ├─warning - │ ├─"test/test_expect_test.ml":2905:10 - │ ├─warning then:test_expect_test:2905 - │ │ ├─"test/test_expect_test.ml":2905:25 + │ ├─"test/test_expect_test.ml":2913:10 + │ ├─warning then:test_expect_test:2913 + │ │ ├─"test/test_expect_test.ml":2913:25 │ │ └─(ERROR: 1 i= 1) │ └─(WARNING: 2 i= 2) ├─warning - │ ├─"test/test_expect_test.ml":2905:10 - │ ├─warning else:test_expect_test:2905 - │ │ └─"test/test_expect_test.ml":2905:68 + │ ├─"test/test_expect_test.ml":2913:10 + │ ├─warning else:test_expect_test:2913 + │ │ └─"test/test_expect_test.ml":2913:68 │ └─(WARNING: 2 i= 3) ├─warning - │ ├─"test/test_expect_test.ml":2905:10 - │ ├─warning else:test_expect_test:2905 - │ │ └─"test/test_expect_test.ml":2905:68 + │ ├─"test/test_expect_test.ml":2913:10 + │ ├─warning else:test_expect_test:2913 + │ │ └─"test/test_expect_test.ml":2913:68 │ └─(WARNING: 2 i= 4) ├─warning - │ ├─"test/test_expect_test.ml":2905:10 - │ ├─warning else:test_expect_test:2905 - │ │ └─"test/test_expect_test.ml":2905:68 + │ ├─"test/test_expect_test.ml":2913:10 + │ ├─warning else:test_expect_test:2913 + │ │ └─"test/test_expect_test.ml":2913:68 │ └─(WARNING: 2 i= 5) └─warning - ├─"test/test_expect_test.ml":2905:10 - ├─warning else:test_expect_test:2905 - │ └─"test/test_expect_test.ml":2905:68 + ├─"test/test_expect_test.ml":2913:10 + ├─warning else:test_expect_test:2913 + │ └─"test/test_expect_test.ml":2913:68 └─(WARNING: 2 i= 6) 21 TOPLEVEL () - └─"test/test_expect_test.ml":2878:17 + └─"test/test_expect_test.ml":2885:17 |}] let%expect_test "%log track while-loop result" = @@ -2984,36 +2993,36 @@ let%expect_test "%log track while-loop result" = {| BEGIN DEBUG SESSION 21 - ├─"test/test_expect_test.ml":2969:17 - └─while:test_expect_test:2972 - ├─"test/test_expect_test.ml":2972:4 + ├─"test/test_expect_test.ml":2978:17 + └─while:test_expect_test:2981 + ├─"test/test_expect_test.ml":2981:4 ├─(3 j= 1) - │ ├─"test/test_expect_test.ml":2973:6 + │ ├─"test/test_expect_test.ml":2982:6 │ ├─ │ ├─(1 i= 0) │ └─(2 i= 1) ├─(3 j= 3) - │ ├─"test/test_expect_test.ml":2973:6 + │ ├─"test/test_expect_test.ml":2982:6 │ ├─ │ ├─(1 i= 1) │ └─(2 i= 2) ├─(3 j= 6) - │ ├─"test/test_expect_test.ml":2973:6 + │ ├─"test/test_expect_test.ml":2982:6 │ ├─ │ ├─(1 i= 2) │ └─(2 i= 3) ├─(3 j= 10) - │ ├─"test/test_expect_test.ml":2973:6 + │ ├─"test/test_expect_test.ml":2982:6 │ ├─ │ ├─(1 i= 3) │ └─(2 i= 4) ├─(3 j= 15) - │ ├─"test/test_expect_test.ml":2973:6 + │ ├─"test/test_expect_test.ml":2982:6 │ ├─ │ ├─(1 i= 4) │ └─(2 i= 5) └─(3 j= 21) - ├─"test/test_expect_test.ml":2973:6 + ├─"test/test_expect_test.ml":2982:6 ├─ ├─(1 i= 5) └─(2 i= 6) @@ -3042,7 +3051,7 @@ let%expect_test "%log without scope" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":3032:17: _bar {#1} + "test/test_expect_test.ml":3041:17: _bar {#1} └─_bar = () {orphaned from #1} └─("This is like", 3, "or", 3.14, "above") @@ -3078,7 +3087,7 @@ let%expect_test "%log without scope values_first_mode" = {| BEGIN DEBUG SESSION _bar = () - └─"test/test_expect_test.ml":3067:17 {#1} + └─"test/test_expect_test.ml":3076:17 {#1} ("This is like", 3, "or", 3.14, "above") └─{orphaned from #1} ("tau =", 6.28) @@ -3126,13 +3135,13 @@ let%expect_test "%log with print_entry_ids, mixed up scopes" = {| BEGIN DEBUG SESSION bar = () - └─"test/test_expect_test.ml":3104:21 {#1} + └─"test/test_expect_test.ml":3113:21 {#1} baz = () - └─"test/test_expect_test.ml":3111:21 {#2} + └─"test/test_expect_test.ml":3120:21 {#2} bar = () - └─"test/test_expect_test.ml":3104:21 {#3} + └─"test/test_expect_test.ml":3113:21 {#3} _foobar = () - ├─"test/test_expect_test.ml":3123:17 {#4} + ├─"test/test_expect_test.ml":3132:17 {#4} ├─("This is like", 3, "or", 3.14, "above") ├─("tau =", 6.28) ├─[3; 1; 2; 3] @@ -3186,13 +3195,13 @@ let%expect_test "%log with print_entry_ids, verbose_entry_ids in HTML, values_fi [%expect {| BEGIN DEBUG SESSION -
{#1} bar = ()
  • "test/test_expect_test.ml":3165:21
+
{#1} bar = ()
  • "test/test_expect_test.ml":3174:21
-
{#2} baz = ()
  • "test/test_expect_test.ml":3172:21
+
{#2} baz = ()
  • "test/test_expect_test.ml":3181:21
-
{#3} bar = ()
  • "test/test_expect_test.ml":3165:21
+
{#3} bar = ()
  • "test/test_expect_test.ml":3174:21
-
{#4} _foobar = ()
  • "test/test_expect_test.ml":3184:17
  • {#3} ("This is like", 3, "or", 3.14, "above")
  • {#3} ("tau =", 6.28)
  • {#2} [3; 1; 2; 3]
  • {#2} [3; 1; 2; 3]
  • {#1} ("This is like", 3, "or", 3.14, "above")
  • {#1} ("tau =", 6.28)
+
{#4} _foobar = ()
  • "test/test_expect_test.ml":3193:17
  • {#3} ("This is like", 3, "or", 3.14, "above")
  • {#3} ("tau =", 6.28)
  • {#2} [3; 1; 2; 3]
  • {#2} [3; 1; 2; 3]
  • {#1} ("This is like", 3, "or", 3.14, "above")
  • {#1} ("tau =", 6.28)
{#2} [3; 1; 2; 3]
  • {orphaned from #2}
@@ -3227,7 +3236,7 @@ let%expect_test "%diagn_show ignores type annots" = 336 109 toplevel - ├─"test/test_expect_test.ml":3208:17 + ├─"test/test_expect_test.ml":3217:17 ├─("for bar, b-3", 42) └─("for baz, f squared", 64) |}] @@ -3253,11 +3262,11 @@ let%expect_test "%diagn_show ignores non-empty bindings" = {| BEGIN DEBUG SESSION bar - ├─"test/test_expect_test.ml":3237:21 + ├─"test/test_expect_test.ml":3246:21 └─("for bar, b-3", 42) 336 baz - ├─"test/test_expect_test.ml":3244:21 + ├─"test/test_expect_test.ml":3253:21 └─("foo baz, f squared", 49) 91 |}] @@ -3316,16 +3325,16 @@ let%expect_test "%debug_show log level compile time" = 336 109 () - ├─"test/test_expect_test.ml":3286:18 + ├─"test/test_expect_test.ml":3295:18 ├─bar - │ ├─"test/test_expect_test.ml":3295:14 + │ ├─"test/test_expect_test.ml":3304:14 │ └─("for bar, b-3", 42) └─baz = 109 - ├─"test/test_expect_test.ml":3303:26 + ├─"test/test_expect_test.ml":3312:26 ├─first = 7 ├─second = 42 ├─{first; second} - │ ├─"test/test_expect_test.ml":3304:12 + │ ├─"test/test_expect_test.ml":3313:12 │ └─ │ ├─first = 8 │ └─second = 45 @@ -3368,11 +3377,11 @@ let%expect_test "%debug_show log level runtime" = └─{orphaned from #5} 336 baz = 109 - ├─"test/test_expect_test.ml":3354:24 + ├─"test/test_expect_test.ml":3363:24 ├─first = 7 ├─second = 42 ├─{first; second} - │ ├─"test/test_expect_test.ml":3355:10 + │ ├─"test/test_expect_test.ml":3364:10 │ └─ │ ├─first = 8 │ └─second = 45 @@ -3392,75 +3401,75 @@ let%expect_test "%debug_show PrintBox snapshot" = {| BEGIN DEBUG SESSION loop_highlight - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 7 └─z = 3 - └─"test/test_expect_test.ml":3386:8 + └─"test/test_expect_test.ml":3395:8 loop_highlight - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 7 ├─z = 3 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 6 ├─z = 2 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 5 ├─z = 2 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 4 ├─z = 1 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 3 └─z = 1 - └─"test/test_expect_test.ml":3386:8 + └─"test/test_expect_test.ml":3395:8 loop_highlight = 9 - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 7 ├─z = 3 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight = 6 - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 6 ├─z = 2 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight = 4 - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 5 ├─z = 2 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight = 2 - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 4 ├─z = 1 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight = 1 - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 3 ├─z = 1 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight = 0 - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 2 ├─z = 0 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight = 0 - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 1 ├─z = 0 - │ └─"test/test_expect_test.ml":3386:8 + │ └─"test/test_expect_test.ml":3395:8 └─loop_highlight = 0 - ├─"test/test_expect_test.ml":3385:36 + ├─"test/test_expect_test.ml":3394:36 ├─x = 0 └─z = 0 - └─"test/test_expect_test.ml":3386:8 + └─"test/test_expect_test.ml":3395:8 9 |}] @@ -3502,7 +3511,7 @@ let%expect_test "%log_printbox" = {| BEGIN DEBUG SESSION foo = () - ├─"test/test_expect_test.ml":3485:21 + ├─"test/test_expect_test.ml":3494:21 ├─0/0│0/1│0/2│0/3│0/4 │ ───┼───┼───┼───┼─── │ 1/0│1/1│1/2│1/3│1/4 @@ -3567,7 +3576,7 @@ let%expect_test "%log_printbox flushing" = [%expect {| BEGIN DEBUG SESSION - foo begin "test/test_expect_test.ml":3547:21: + foo begin "test/test_expect_test.ml":3556:21: 0/0│0/1│0/2│0/3│0/4 ───┼───┼───┼───┼─── 1/0│1/1│1/2│1/3│1/4 @@ -3592,7 +3601,7 @@ let%expect_test "%log_printbox flushing" = 4/0 4/1 4/2 4/3 4/4 - bar begin "test/test_expect_test.ml":3556:12: + bar begin "test/test_expect_test.ml":3565:12: "Now with a frame:" ┌───┬───┬───┬───┬───┐ │0/0│0/1│0/2│0/3│0/4│ @@ -3652,7 +3661,7 @@ let%expect_test "%log_entry" = [%expect {| BEGIN DEBUG SESSION - "test/test_expect_test.ml":3616:17: _logging_logic + "test/test_expect_test.ml":3625:17: _logging_logic ├─"preamble" ├─header 1 │ ├─"log 1" @@ -3692,36 +3701,36 @@ let%expect_test "flame graph" = print_endline output; [%expect {| -
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
- @@ -3796,31 +3805,31 @@ let%expect_test "flame graph reduced ToC" = print_endline output; [%expect {| -
+
-
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
-
+
-
+
-
+
- @@ -3878,10 +3887,10 @@ let%expect_test "%debug_show skip module bindings" = {| BEGIN DEBUG SESSION bar = 15 - ├─"test/test_expect_test.ml":3866:21 + ├─"test/test_expect_test.ml":3875:21 ├─x = 7 └─y = 8 - └─"test/test_expect_test.ml":3868:8 + └─"test/test_expect_test.ml":3877:8 15 |}] @@ -3907,52 +3916,52 @@ let%expect_test "%track_l_show procedure runtime passing" = [%expect {| BEGIN DEBUG SESSION foo-1 - foo-1 foo begin "test/test_expect_test.ml":3893:23: + foo-1 foo begin "test/test_expect_test.ml":3902:23: "inside foo" foo-1 foo end BEGIN DEBUG SESSION foo-1 - foo-1 () begin "test/test_expect_test.ml":3899:8: + foo-1 () begin "test/test_expect_test.ml":3908:8: "inside bar" foo-1 () end BEGIN DEBUG SESSION foo-2 - foo-2 foo begin "test/test_expect_test.ml":3893:23: + foo-2 foo begin "test/test_expect_test.ml":3902:23: "inside foo" foo-2 foo end BEGIN DEBUG SESSION foo-2 - foo-2 () begin "test/test_expect_test.ml":3899:8: + foo-2 () begin "test/test_expect_test.ml":3908:8: "inside bar" foo-2 () end BEGIN DEBUG SESSION foo-3 - foo-3 foo begin "test/test_expect_test.ml":3893:23: + foo-3 foo begin "test/test_expect_test.ml":3902:23: "inside foo" foo-3 foo end BEGIN DEBUG SESSION foo-3 - foo-3 () begin "test/test_expect_test.ml":3899:8: + foo-3 () begin "test/test_expect_test.ml":3908:8: "inside bar" foo-3 () end BEGIN DEBUG SESSION foo-4 - foo-4 foo begin "test/test_expect_test.ml":3893:23: + foo-4 foo begin "test/test_expect_test.ml":3902:23: "inside foo" foo-4 foo end BEGIN DEBUG SESSION foo-4 - foo-4 () begin "test/test_expect_test.ml":3899:8: + foo-4 () begin "test/test_expect_test.ml":3908:8: "inside bar" foo-4 () end BEGIN DEBUG SESSION foo-5 - foo-5 foo begin "test/test_expect_test.ml":3893:23: + foo-5 foo begin "test/test_expect_test.ml":3902:23: "inside foo" foo-5 foo end BEGIN DEBUG SESSION foo-5 - foo-5 () begin "test/test_expect_test.ml":3899:8: + foo-5 () begin "test/test_expect_test.ml":3908:8: "inside bar" foo-5 () end |}] @@ -3968,11 +3977,11 @@ let%expect_test "%track_rt_show expression runtime passing" = "test B"; [%log "line B"]]] (Minidebug_runtime.debug_flushing ~global_prefix:"t2" ()); - [%track_rtb_show + [%track_rt_show [%log_entry "test C"; [%log "line C"]]] - (Minidebug_runtime.debug ~global_prefix:"t3" ~log_level:0 ()); + Minidebug_runtime.(forget_printbox @@ debug ~global_prefix:"t3" ~log_level:0 ()); [%expect {| BEGIN DEBUG SESSION t1 @@ -4012,18 +4021,18 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = ┌─────────┐ │bar = 336│ ├─────────┘ - ├─"test/test_expect_test.ml":3996:21 + ├─"test/test_expect_test.ml":4005:21 ├─first = 7 ├─second = 42 └─┬─────┐ │y = 8│ ├─────┘ - └─"test/test_expect_test.ml":3997:8 + └─"test/test_expect_test.ml":4006:8 336 ┌────────┐ │(r1, r2)│ ├────────┘ - ├─"test/test_expect_test.ml":4006:17 + ├─"test/test_expect_test.ml":4015:17 ├─┬─────────┐ │ ││ │ ├─────────┘ @@ -4034,13 +4043,13 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = └─┬────────────────┐ │baz = (339, 109)│ ├────────────────┘ - ├─"test/test_expect_test.ml":4001:21 + ├─"test/test_expect_test.ml":4010:21 ├─first = 7 ├─second = 42 ├─┬──────┐ │ │(y, z)│ │ ├──────┘ - │ ├─"test/test_expect_test.ml":4002:8 + │ ├─"test/test_expect_test.ml":4011:8 │ └─┬────────┐ │ ││ │ ├────────┘ @@ -4051,7 +4060,7 @@ let%expect_test "%debug_show tuples values_first_mode highlighted" = └─┬──────┐ │(a, b)│ ├──────┘ - ├─"test/test_expect_test.ml":4003:8 + ├─"test/test_expect_test.ml":4012:8 └─┬────────┐ ││ ├────────┘