ocaml/merlin

Example of locate failing to resolve (with opam monorepo)

ddickstein opened this issue · 1 comments

Jumping to the definition of Import here is failing with "Several source files in your path have the same name, and merlin doesn't know which is the right one" with paths to a variety of import.ml files in Jane Street libs.

Repro steps

  1. Create a new OCaml project and add a dependency on async (version 0.17.0).
  2. Use opam-monorepo to pull in sources.
  3. Build the project.
  4. Attempt to jump to the definition of Import opened on line 2 of duniverse/async/async_rpc/src/rpc.ml.

Thanks for the report @ddickstein. I am not able to use opam-monorepo to pull. I suppose I should run opam monorepo lock and then opam monorepo pull but it fails with:

❯ opam monorepo lock
==> Using 1 locally scanned package as the target.
[WARNING] Unknown variable "with-dev-setup"
[WARNING] Unknown variable "with-dev-setup"
opam-monorepo: [ERROR] There is no eligible version of uutf that matches >= 1.0.2
[WARNING] Unknown variable "with-dev-setup"
opam-monorepo: [WARNING] Couldn't calculate a set of packages to satisfy the request. Note that opam monorepo lock will fail if not all of the project dependencies use dune as their build system, in your project that would be fmt. To solve this issue there exists a dune-universe opam-repository which contains dune ports for some opam packages, but it is currently not set in your current switch. If you wish to set it up, run the following command:
opam repository add dune-universe git+https://github.com/dune-universe/opam-overlays.git
[WARNING] Unknown variable "with-dev-setup"
opam-monorepo: [ERROR] Can't find all required versions.
Selected: async.v0.17.0 async_kernel.v0.17.0 async_log.v0.17.0
          async_rpc_kernel.v0.17.0 async_unix.v0.17.0 base.v0.17.1
          base-bigarray.base base-domains.base base-nnp.base
          base-threads.base base-unix.base base_bigstring.v0.17.0
          base_quickcheck.v0.17.0 bin_prot.v0.17.0 capitalization.v0.17.0
          core.v0.17.1 core_kernel.v0.17.0 core_unix.v0.17.0 csexp.1.5.2
          cstruct.6.2.0 dune.3.16.0 dune-configurator.3.16.0
          expect_test_helpers_core.v0.17.0 fieldslib.v0.17.0 gel.v0.17.0
          host-arch-arm64.1 int_repr.v0.17.0 jane-street-headers.v0.17.0
          jst-config.v0.17.0 ocaml-base-compiler.5.2.0
          ocaml-compiler-libs.v0.17.0 ocaml-config.3 ocaml-options-vanilla.1
          ocaml_intrinsics_kernel.v0.17.1 parsexp.v0.17.0 ppx_assert.v0.17.0
          ppx_base.v0.17.0 ppx_bench.v0.17.0 ppx_bin_prot.v0.17.0
          ppx_cold.v0.17.0 ppx_compare.v0.17.0 ppx_custom_printf.v0.17.0
          ppx_derivers.1.2.1 ppx_diff.v0.17.0
          ppx_disable_unused_warnings.v0.17.0 ppx_enumerate.v0.17.0
          ppx_expect.v0.17.0 ppx_fields_conv.v0.17.0
          ppx_fixed_literal.v0.17.0 ppx_globalize.v0.17.0 ppx_hash.v0.17.0
          ppx_here.v0.17.0 ppx_ignore_instrumentation.v0.17.0
          ppx_inline_test.v0.17.0 ppx_jane.v0.17.0 ppx_let.v0.17.0
          ppx_log.v0.17.0 ppx_module_timer.v0.17.0 ppx_optcomp.v0.17.0
          ppx_optional.v0.17.0 ppx_pipebang.v0.17.0 ppx_sexp_conv.v0.17.0
          ppx_sexp_message.v0.17.0 ppx_sexp_value.v0.17.0 ppx_stable.v0.17.0
          ppx_stable_witness.v0.17.0 ppx_string.v0.17.0
          ppx_string_conv.v0.17.0 ppx_tydi.v0.17.0 ppx_typerep_conv.v0.17.0
          ppx_variants_conv.v0.17.0 ppxlib.0.33.0 ppxlib_jane.v0.17.0
          protocol_version_header.v0.17.0 re.1.12.0 seq.base
          sexp_pretty.v0.17.0 sexplib.v0.17.0 sexplib0.v0.17.0 spawn.v0.15.1
          splittable_random.v0.17.0 stdio.v0.17.0 stdlib-shims.0.3.0
          textutils.v0.17.0 time_now.v0.17.0 timezone.v0.17.0 typerep.v0.17.0
          uopt.v0.17.0 variantslib.v0.17.0 ocaml-base-compiler&async
          system-mingw ocaml-base-compiler ocaml-base-compiler ocaml
          base-domains ocaml ocaml-base-compiler
- fmt -> (problem)
    No usable implementations:
      fmt.0.9.0: Doesn't build with dune
      fmt.0.8.10: Doesn't build with dune
      fmt.0.8.9: Doesn't build with dune
      fmt.0.8.8: Doesn't build with dune
      fmt.0.8.7: Doesn't build with dune
      ...
- num -> (problem)
    Rejected candidates:
      num.0: Requires ocaml < 4.06.0
      num.1.5-1: Doesn't build with dune
      num.1.5: Doesn't build with dune
      num.1.4: Doesn't build with dune
      num.1.3: Doesn't build with dune
      ...
- ocaml -> ocaml.5.2.0
    ocaml-base-compiler 5.2.0 requires = 5.2.0
- system-mingw -> (problem)
    No known implementations at all
- uutf -> (problem)
    textutils v0.17.0 requires >= 1.0.2
    Rejected candidates:
      uutf.0.9.3: Incompatible with restriction: >= 1.0.2
      uutf.0.9.1: Incompatible with restriction: >= 1.0.2
      uutf.1.0.3: Doesn't build with dune
      uutf.1.0.2: Doesn't build with dune
      uutf.1.0.1: Doesn't build with dune
      ...
      ```