jmid / mutaml

An OCaml mutation tester
BSD 2-Clause "Simplified" License
65 stars 4 forks source link

pattern match error when instrumenting dune_engine #22

Closed Alizter closed 1 year ago

Alizter commented 1 year ago

Yesterday when I was instrumenting dune_engine I ran into a compiler warning only when building with the instrumentation.

To reproduce:

  1. Clone the https://github.com/ocaml/dune repository.
  2. Dune doesn't need any libraries, so the opam switch for mutaml should be fine. You can even plop dune inside mutaml and build it directly from there so dune can find the mutaml lib incase it is not inside the switch.
  3. In https://github.com/ocaml/dune/blob/main/src/dune_engine/dune add another (instrumentation) field at the end for mutaml.
  4. Do dune build @src/dune_engine/check --instrument-with mutaml and you will get an error (fatal warning).
File "src/dune_engine/process.ml", line 673, characters 8-17:
673 |       | WEXITED n -> Error (Failed n)
              ^^^^^^^^^
Error (warning 12 [redundant-subpat]): this sub-pattern is unused.

My workaround yesterday was to just do the build in --profile release so that compiler warnings were non-fatal. I thought I would report this anyway. This isn't quite a compiler error that you've said needs reporting, but I thought I'd mention it anyway in case there is something you can do about it.

I fell like redundant cases can be removed if they are detected. No idea if this is simple to do.

jmid commented 1 year ago

Thanks for sharing! :pray: I agree that mutations should avoid fatal warnings if possible. I'm supposed to be on holiday and unplug, so it may take a bit before I take a more in depth look at fixing it.

Alizter commented 1 year ago

No rush! Just wanted to make note of things before I forget.

jmid commented 1 year ago

I have a suggested fix in #23. With it the dune build @src/dune_engine/check --instrument-with mutaml command succeeds on my machine.