merlin icon indicating copy to clipboard operation
merlin copied to clipboard

Modules opened in the wrong order?

Open vouillon opened this issue 10 months ago • 4 comments

I get an error when I edit file link.ml even though Dune compiles it just fine. Image

When compiling the library Wasm_of_ocaml_compiler which contains this file, I also open the library Js_of_ocaml_compiler. Both libraries contain a file generate.ml.

(library
 (name wasm_of_ocaml_compiler)
 (libraries js_of_ocaml_compiler)
 (flags
  (:standard -w -7-37 -safe-string -open Js_of_ocaml_compiler))
[...]

I suspect what happens is that merlin and dune do not perform the opens in the same order.

Adding an explicit open flag, even in the wrong order, seems to work around the issue.

 (flags
  (:standard -w -7-37 -safe-string -open Wasm_of_ocaml_compiler -open Js_of_ocaml_compiler))

I have taken a dump of the configuration.

vouillon avatar Feb 21 '25 15:02 vouillon

Thanks for the report Jérôme. That's indeed very suspicious. I will try to find some time to investigate, meanwhile, do you think you could craft a smaller reproduction ?

voodoos avatar Feb 24 '25 12:02 voodoos

  1. unzip merlin-bug.zip
  2. cd merlin-bug
  3. dune exec -- ./main.exe
  4. Open main.ml in your editor Image

vouillon avatar Feb 24 '25 12:02 vouillon

Thanks a lot, I added your example to the testsuite and proposed a change in Dune. The ordering is indeed wrong in the generated configuration. (but not in Merlin's treatment of the ordering)

voodoos avatar Feb 25 '25 13:02 voodoos

Thanks !

vouillon avatar Feb 25 '25 16:02 vouillon