bitstring icon indicating copy to clipboard operation
bitstring copied to clipboard

Unable to use it in the preprocess stanza of dune

Open agorer opened this issue 1 year ago • 2 comments

After installing bitstring and ppx_bitstring (both 4.1.0 version) whenever I try to build a project that depends on them I got the error "Unexpected list". This is how I set them on dune file:

(library
 (name whatever)
 (inline_tests (deps (glob_files %{project_root}/test/*.txt)))
 (libraries bitstring)
 (preprocess (pps ppx_inline_test (ppx_bitstring))))

also tried removing parenthesis and got a different error ("Fatal error: exception Invalid_argument("List.map2")"). When dune file set like:

(library
 (name whatever)
 (inline_tests (deps (glob_files %{project_root}/test/*.txt)))
 (libraries bitstring)
 (preprocess (pps ppx_inline_test ppx_bitstring)))

Is there any configuration I am missing?

agorer avatar Nov 01 '24 08:11 agorer

Bitstring's own test use the dune pps notation so it's unlikely a problem with that. However, there could be an impedance mismatch between ppx_inline_tests and bitstring. Send me a minimal example that reproduces the problem and I'll take a look.

xguerin avatar Nov 01 '24 15:11 xguerin

Ok, so there were two different issues:

  1. Using parentheses on the dune stanza gives you the list error. Checking the test code is seems that they are not used, but in the documentation and README they seem to be used (you can see a minimal example in the attached file).
  2. The other (Invalid_argument("List.map2")) error was due to using an invalid pattern ({| b1::8, b2::8 |}), so the error message is a little misleading but it was a bug in the code.

minimal.zip

agorer avatar Nov 01 '24 16:11 agorer

Yeah those parentheses are not needed. I'll update the documentation. Thanks for the example.

xguerin avatar Aug 19 '25 14:08 xguerin