bisect_ppx icon indicating copy to clipboard operation
bisect_ppx copied to clipboard

Type error when instrumenting

Open 7h3kk1d opened this issue 8 months ago • 1 comments

Hi, we're using bisect_ppx 2.8.3 in Hazel for Reason code. We had a weird issue where our code stopped compiling when running with --instrument-with bisect_ppx as the analyzed type seems incorrect. The code still runs without it. Adding a type annotation fixed the issue.

Failing build: https://github.com/hazelgrove/hazel/actions/runs/14561798665/job/40904394222#step:15:62 Added signature that solved the problem: https://github.com/hazelgrove/hazel/pull/1444/commits/283e54ba04ad2e45531c30a0839362d7b4549933#diff-a9ca0d4f53786cf399607e94bf000affdf51e7b47a00d546c73eae08205ba70aR505

The compilation error:

 File "src/haz3lweb/view/ExerciseMode.re", lines 510-515, characters 8-49:
510 | ........CellEditor.Selection.handle_key_event(
511 |           ~selection=s,
512 |           ~event,
513 |           cell_editor,
514 |         )
515 |         |> Option.map(a => Update.Editor(pos, a))
Error: This expression has type Update.t option
       but an expression was expected of type Node.t

I'm still working on minimizing a test case for this but any help in how to view the instrumented code would be valued. Thanks!

7h3kk1d avatar Apr 22 '25 14:04 7h3kk1d

Hi! I'm a bisect_ppx user too.

any help in how to view the instrumented code would be valued

Assuming you use dune - to help looking at the instrumented code, for ml files I have in the past used the following command:

$ dune describe pp path/to/file.ml --instrument-with=bisect_ppx

(assuming the file in question is configured to be instrumented via the dune file).

I don't know about re files, but maybe this just works the same?

mbarbin avatar Apr 22 '25 16:04 mbarbin