From 257a373ca0210dd4e3c6dc14737a537ba2b752b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Tue, 25 Oct 2022 16:25:35 +0200 Subject: [PATCH] Add all dependency source dirs to Merlin's configuration. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use new BH / SH directives Make specific tests for OCaml 5.2 Signed-off-by: Ulysse GĂ©rard --- src/dune_rules/exe_rules.ml | 5 +- src/dune_rules/lib_rules.ml | 5 +- src/dune_rules/melange/melange_rules.ml | 4 +- src/dune_rules/merlin/merlin.ml | 132 +++++++++++++----- src/dune_rules/merlin/merlin.mli | 3 +- test/blackbox-tests/test-cases/merlin/dune | 8 ++ .../implicit-transitive-deps-5.2.t/bin/dune | 4 + .../bin/main.ml | 1 + .../dune-project | 2 + .../implicit-transitive-deps-5.2.t/run.t | 44 ++++++ .../src/lib1/dune | 3 + .../src/lib1/lib1.ml | 1 + .../src/lib2/dune | 3 + .../src/lib2/lib2.ml | 3 + .../implicit-transitive-deps.t/dune-project | 4 +- .../merlin/implicit-transitive-deps.t/run.t | 19 ++- 16 files changed, 195 insertions(+), 46 deletions(-) create mode 100644 test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/bin/dune create mode 100644 test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/bin/main.ml create mode 100644 test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/dune-project create mode 100644 test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/run.t create mode 100644 test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib1/dune create mode 100644 test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib1/lib1.ml create mode 100644 test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib2/dune create mode 100644 test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib2/lib2.ml diff --git a/src/dune_rules/exe_rules.ml b/src/dune_rules/exe_rules.ml index edc6a78487d8..5c9d0ff66168 100644 --- a/src/dune_rules/exe_rules.ml +++ b/src/dune_rules/exe_rules.ml @@ -197,7 +197,7 @@ let executables_rules let lib_config = ocaml.lib_config in let stdlib_dir = lib_config.stdlib_dir in let* requires_compile = Compilation_context.requires_compile cctx in - let* requires_link = Compilation_context.requires_link cctx in + let* requires_hidden = Compilation_context.requires_hidden cctx in let* dep_graphs = (* Building an archive for foreign stubs, we link the corresponding object files directly to improve perf. *) @@ -281,7 +281,8 @@ let executables_rules in ( cctx , Merlin.make - ~requires:requires_link + ~requires_compile + ~requires_hidden ~stdlib_dir ~flags ~modules diff --git a/src/dune_rules/lib_rules.ml b/src/dune_rules/lib_rules.ml index 5db0c2b71545..4edef02046d7 100644 --- a/src/dune_rules/lib_rules.ml +++ b/src/dune_rules/lib_rules.ml @@ -572,7 +572,7 @@ let library_rules let scope = Compilation_context.scope cctx in let* requires_compile = Compilation_context.requires_compile cctx in let ocaml = Compilation_context.ocaml cctx in - let* requires_link = Compilation_context.requires_link cctx in + let* requires_hidden = Compilation_context.requires_hidden cctx in let stdlib_dir = ocaml.lib_config.stdlib_dir in let top_sorted_modules = let impl_only = Modules.With_vlib.impl_only modules in @@ -628,7 +628,8 @@ let library_rules in ( cctx , Merlin.make - ~requires:requires_link + ~requires_compile + ~requires_hidden ~stdlib_dir ~flags ~modules diff --git a/src/dune_rules/melange/melange_rules.ml b/src/dune_rules/melange/melange_rules.ml index f3a456459a6b..80e1665af21d 100644 --- a/src/dune_rules/melange/melange_rules.ml +++ b/src/dune_rules/melange/melange_rules.ml @@ -326,6 +326,7 @@ let setup_emit_cmj_rules in let* () = Module_compilation.build_all cctx in let* requires_compile = Compilation_context.requires_compile cctx in + let* requires_hidden = Compilation_context.requires_hidden cctx in let stdlib_dir = (Compilation_context.ocaml cctx).lib_config.stdlib_dir in let+ () = let emit_and_libs_deps = @@ -354,7 +355,8 @@ let setup_emit_cmj_rules in ( cctx , Merlin.make - ~requires:requires_compile + ~requires_compile + ~requires_hidden ~stdlib_dir ~flags ~modules diff --git a/src/dune_rules/merlin/merlin.ml b/src/dune_rules/merlin/merlin.ml index 742ba34570a0..19cfb2f864a9 100644 --- a/src/dune_rules/merlin/merlin.ml +++ b/src/dune_rules/merlin/merlin.ml @@ -51,13 +51,24 @@ module Processed = struct ; source_root : Path.t ; obj_dirs : Path.Set.t ; src_dirs : Path.Set.t + ; hidden_obj_dirs : Path.Set.t + ; hidden_src_dirs : Path.Set.t ; flags : string list ; extensions : string option Ml_kind.Dict.t list ; indexes : Path.t list } let dyn_of_config - { stdlib_dir; source_root; obj_dirs; src_dirs; flags; extensions; indexes } + { stdlib_dir + ; source_root + ; obj_dirs + ; src_dirs + ; hidden_obj_dirs + ; hidden_src_dirs + ; flags + ; extensions + ; indexes + } = let open Dyn in record @@ -65,6 +76,8 @@ module Processed = struct ; "source_root", Path.to_dyn source_root ; "obj_dirs", Path.Set.to_dyn obj_dirs ; "src_dirs", Path.Set.to_dyn src_dirs + ; "hidden_obj_dirs", Path.Set.to_dyn hidden_obj_dirs + ; "hidden_src_dirs", Path.Set.to_dyn hidden_src_dirs ; "flags", list string flags ; "extensions", list (Ml_kind.Dict.to_dyn (Dyn.option string)) extensions ; "indexes", list Path.to_dyn indexes @@ -115,6 +128,8 @@ module Processed = struct ; source_root = Path.Source.root |> Path.source ; obj_dirs = Path.Set.empty ; src_dirs = Path.Set.empty + ; hidden_obj_dirs = Path.Set.empty + ; hidden_src_dirs = Path.Set.empty ; flags = [ "-x" ] ; extensions = [ { Ml_kind.Dict.intf = None; impl = Some "ext" } ] ; indexes = [] @@ -162,7 +177,16 @@ module Processed = struct ~opens ~pp ~reader - { stdlib_dir; source_root; obj_dirs; src_dirs; flags; extensions; indexes } + { stdlib_dir + ; source_root + ; obj_dirs + ; src_dirs + ; hidden_obj_dirs + ; hidden_src_dirs + ; flags + ; extensions + ; indexes + } = let make_directive tag value = Sexp.List [ Atom tag; value ] in let make_directive_of_path tag path = @@ -178,6 +202,12 @@ module Processed = struct let exclude_query_dir = [ Sexp.List [ Atom "EXCLUDE_QUERY_DIR" ] ] in let obj_dirs = Path.Set.to_list_map obj_dirs ~f:(make_directive_of_path "B") in let src_dirs = Path.Set.to_list_map src_dirs ~f:(make_directive_of_path "S") in + let hidden_obj_dirs = + Path.Set.to_list_map hidden_obj_dirs ~f:(make_directive_of_path "BH") + in + let hidden_src_dirs = + Path.Set.to_list_map hidden_src_dirs ~f:(make_directive_of_path "SH") + in let flags = let flags = match flags with @@ -222,6 +252,8 @@ module Processed = struct ; exclude_query_dir ; obj_dirs ; src_dirs + ; hidden_obj_dirs + ; hidden_src_dirs ; flags ; unit_name ; suffixes @@ -249,6 +281,8 @@ module Processed = struct flags obj_dirs src_dirs + hidden_obj_dirs + hidden_src_dirs extensions indexes = @@ -261,6 +295,8 @@ module Processed = struct printf "SOURCE_ROOT %s\n" (serialize_path source_root); Path.Set.iter obj_dirs ~f:(fun p -> printf "B %s\n" (serialize_path p)); Path.Set.iter src_dirs ~f:(fun p -> printf "S %s\n" (serialize_path p)); + Path.Set.iter hidden_obj_dirs ~f:(fun p -> printf "BH %s\n" (serialize_path p)); + Path.Set.iter hidden_src_dirs ~f:(fun p -> printf "SH %s\n" (serialize_path p)); List.iter indexes ~f:(fun p -> printf "INDEX %s\n" (serialize_path p)); List.iter extensions ~f:(fun x -> Option.iter (get_ext x) ~f:(fun (impl, intf) -> @@ -335,7 +371,15 @@ module Processed = struct | Error msg -> Printf.eprintf "%s\n" msg | Ok [] -> Printf.eprintf "No merlin configuration found.\n" | Ok (init :: tl) -> - let pp_configs, obj_dirs, src_dirs, flags, extensions, indexes = + let ( pp_configs + , obj_dirs + , src_dirs + , hidden_obj_dirs + , hidden_src_dirs + , flags + , extensions + , indexes ) + = (* We merge what is easy to merge and ignore the rest *) List.fold_left tl @@ -343,12 +387,21 @@ module Processed = struct ( [ init.pp_config ] , init.config.obj_dirs , init.config.src_dirs + , init.config.hidden_obj_dirs + , init.config.hidden_src_dirs , [ init.config.flags ] , init.config.extensions , init.config.indexes ) ~f: (fun - (acc_pp, acc_obj, acc_src, acc_flags, acc_ext, acc_indexes) + ( acc_pp + , acc_obj + , acc_src + , acc_hidden_obj + , acc_hidden_src + , acc_flags + , acc_ext + , acc_indexes ) { per_file_config = _ ; pp_config ; config = @@ -356,6 +409,8 @@ module Processed = struct ; source_root = _ ; obj_dirs ; src_dirs + ; hidden_obj_dirs + ; hidden_src_dirs ; flags ; extensions ; indexes @@ -365,6 +420,8 @@ module Processed = struct ( pp_config :: acc_pp , Path.Set.union acc_obj obj_dirs , Path.Set.union acc_src src_dirs + , Path.Set.union acc_hidden_obj hidden_obj_dirs + , Path.Set.union acc_hidden_src hidden_src_dirs , flags :: acc_flags , extensions @ acc_ext , indexes @ acc_indexes )) @@ -378,6 +435,8 @@ module Processed = struct flags obj_dirs src_dirs + hidden_obj_dirs + hidden_src_dirs extensions indexes) ;; @@ -399,7 +458,8 @@ module Unprocessed = struct Processed.t] *) type config = { stdlib_dir : Path.t - ; requires : Lib.Set.t + ; requires_compile : Lib.t list Resolve.t + ; requires_hidden : Lib.t list Resolve.t ; flags : string list Action_builder.t ; preprocess : Preprocess.Without_instrumentation.t Preprocess.t Module_name.Per_item.t @@ -418,7 +478,8 @@ module Unprocessed = struct } let make - ~requires + ~requires_compile + ~requires_hidden ~stdlib_dir ~flags ~preprocess @@ -437,11 +498,6 @@ module Unprocessed = struct | `Melange_emit -> Melange | `Lib (m : Lib_mode.Map.Set.t) -> Lib_mode.Map.Set.for_merlin m in - let requires = - match Resolve.peek requires with - | Ok l -> Lib.Set.of_list l - | Error () -> Lib.Set.empty - in let objs_dirs = Path.Set.singleton @@ obj_dir_of_lib `Private mode (Obj_dir.of_local obj_dir) in @@ -450,7 +506,8 @@ module Unprocessed = struct let config = { stdlib_dir ; mode - ; requires + ; requires_compile + ; requires_hidden ; flags ; preprocess ; libname @@ -556,6 +613,21 @@ module Unprocessed = struct ~f:(pp_flags ctx ~expander t.config.libname) ;; + let add_lib_dirs sctx mode ~init libs = + Action_builder.of_memo + (let open Memo.O in + Memo.parallel_map libs ~f:(fun lib -> + let+ dirs = src_dirs sctx lib in + lib, dirs) + >>| List.fold_left ~init ~f:(fun (src_dirs, obj_dirs) (lib, more_src_dirs) -> + ( Path.Set.union src_dirs more_src_dirs + , let public_cmi_dir = + let info = Lib.info lib in + obj_dir_of_lib `Public mode (Lib_info.obj_dir info) + in + Path.Set.add obj_dirs public_cmi_dir ))) + ;; + let process ({ modules ; ident = _ @@ -566,7 +638,8 @@ module Unprocessed = struct ; flags ; objs_dirs ; source_dirs - ; requires + ; requires_compile + ; requires_hidden ; preprocess = _ ; libname = _ ; mode @@ -591,9 +664,11 @@ module Unprocessed = struct | [] -> None | stdlib_dir :: _ -> Some stdlib_dir) in - let* requires = + let* requires_compile = Resolve.read requires_compile in + let* requires_hidden = Resolve.read requires_hidden in + let* requires_compile, requires_hidden = match t.config.mode with - | Ocaml _ -> Action_builder.return requires + | Ocaml _ -> Action_builder.return (requires_compile, requires_hidden) | Melange -> Action_builder.of_memo (let open Memo.O in @@ -612,26 +687,17 @@ module Unprocessed = struct | Ok libs -> libs | Error _ -> [] in - Lib.Set.union requires (Lib.Set.of_list libs) - | None -> Memo.return requires) + List.concat [ requires_compile; libs ], requires_hidden + | None -> Memo.return (requires_compile, requires_hidden)) in let+ flags = flags + and+ indexes = Action_builder.of_memo (Ocaml_index.context_indexes sctx) and+ src_dirs, obj_dirs = - Action_builder.of_memo - (let open Memo.O in - Memo.parallel_map (Lib.Set.to_list requires) ~f:(fun lib -> - let+ dirs = src_dirs sctx lib in - lib, dirs) - >>| List.fold_left - ~init:(Path.set_of_source_paths source_dirs, objs_dirs) - ~f:(fun (src_dirs, obj_dirs) (lib, more_src_dirs) -> - ( Path.Set.union src_dirs more_src_dirs - , let public_cmi_dir = - let info = Lib.info lib in - obj_dir_of_lib `Public mode (Lib_info.obj_dir info) - in - Path.Set.add obj_dirs public_cmi_dir ))) - and+ indexes = Action_builder.of_memo (Ocaml_index.context_indexes sctx) in + let init = Path.set_of_source_paths source_dirs, objs_dirs in + add_lib_dirs sctx mode ~init requires_compile + and+ hidden_src_dirs, hidden_obj_dirs = + add_lib_dirs sctx mode ~init:(Path.Set.empty, Path.Set.empty) requires_hidden + in let src_dirs = Path.Set.union src_dirs (Path.Set.of_list_map ~f:Path.source more_src_dirs) in @@ -640,6 +706,8 @@ module Unprocessed = struct ; source_root ; src_dirs ; obj_dirs + ; hidden_src_dirs + ; hidden_obj_dirs ; flags ; extensions ; indexes diff --git a/src/dune_rules/merlin/merlin.mli b/src/dune_rules/merlin/merlin.mli index 57f92caa22c1..8f89938f0ccc 100644 --- a/src/dune_rules/merlin/merlin.mli +++ b/src/dune_rules/merlin/merlin.mli @@ -41,7 +41,8 @@ module Processed : sig end val make - : requires:Lib.t list Resolve.t + : requires_compile:Lib.t list Resolve.t + -> requires_hidden:Lib.t list Resolve.t -> stdlib_dir:Path.t -> flags:Ocaml_flags.t -> preprocess:Preprocess.Without_instrumentation.t Preprocess.t Module_name.Per_item.t diff --git a/test/blackbox-tests/test-cases/merlin/dune b/test/blackbox-tests/test-cases/merlin/dune index bd374865ffd1..30732e0a3cc2 100644 --- a/test/blackbox-tests/test-cases/merlin/dune +++ b/test/blackbox-tests/test-cases/merlin/dune @@ -9,3 +9,11 @@ (cram (applies_to github4125) (deps %{bin:opam})) + +(cram + (applies_to implicit-transitive-deps) + (enabled_if (< %{ocaml_version} 5.2))) + +(cram + (applies_to implicit-transitive-deps-5.2) + (enabled_if (>= %{ocaml_version} 5.2))) diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/bin/dune b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/bin/dune new file mode 100644 index 000000000000..7f57e46dfb5a --- /dev/null +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/bin/dune @@ -0,0 +1,4 @@ +(executable + (name main) + (flags :standard -w -34) + (libraries lib1)) diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/bin/main.ml b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/bin/main.ml new file mode 100644 index 000000000000..2f5fb3b592da --- /dev/null +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/bin/main.ml @@ -0,0 +1 @@ +type t = Lib1.t \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/dune-project b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/dune-project new file mode 100644 index 000000000000..fff9b78b8427 --- /dev/null +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/dune-project @@ -0,0 +1,2 @@ +(lang dune 3.17) +(implicit_transitive_deps false) diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/run.t b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/run.t new file mode 100644 index 000000000000..f103b7e807f8 --- /dev/null +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/run.t @@ -0,0 +1,44 @@ + $ stdlib="$(ocamlc -where)" + $ export BUILD_PATH_PREFIX_MAP="/STDLIB=$stdlib:$BUILD_PATH_PREFIX_MAP" + + $ dune build @check + +Merlin must be able to locate the definitions of values coming from an +implicit transitive dependency, even when `implicit-transitive-dependency` is +set to `false`. They should be part of the source path returned by the +configuration. + +In this test the dependencies are as follow: +main -> lib1 -> lib2 -> stdlib + +When using OCaml >= 5.2 these hidden dependencies are passed to merlin using the +new `*H` directives. + $ FILE=$PWD/bin/main.ml + $ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin | + > sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?" + ?:B?:$TESTCASE_ROOT/_build/default/bin/.main.eobjs/byte) + ?:B?:$TESTCASE_ROOT/_build/default/src/lib1/.lib1.objs/byte) + ?:S?:$TESTCASE_ROOT/bin) + ?:S?:$TESTCASE_ROOT/src/lib1) + ?:BH?:/STDLIB/unix) + ?:BH?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte) + ?:SH?:/STDLIB/unix) + ?:SH?:$TESTCASE_ROOT/src/lib2) + + $ FILE=$PWD/src/lib1/lib1.ml + $ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin | + > sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?" + ?:B?:/STDLIB/unix) + ?:B?:$TESTCASE_ROOT/_build/default/src/lib1/.lib1.objs/byte) + ?:B?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte) + ?:S?:/STDLIB/unix) + ?:S?:$TESTCASE_ROOT/src/lib1) + ?:S?:$TESTCASE_ROOT/src/lib2) + + $ FILE=$PWD/src/lib2/lib2.ml + $ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin | + > sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?" + ?:B?:/STDLIB/unix) + ?:B?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte) + ?:S?:/STDLIB/unix) + ?:S?:$TESTCASE_ROOT/src/lib2) diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib1/dune b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib1/dune new file mode 100644 index 000000000000..659f51cccfaa --- /dev/null +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib1/dune @@ -0,0 +1,3 @@ +(library + (name lib1) + (libraries lib2 unix)) diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib1/lib1.ml b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib1/lib1.ml new file mode 100644 index 000000000000..8b4941c18c68 --- /dev/null +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib1/lib1.ml @@ -0,0 +1 @@ +include Lib2 diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib2/dune b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib2/dune new file mode 100644 index 000000000000..eba0287a9ddd --- /dev/null +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib2/dune @@ -0,0 +1,3 @@ +(library + (name lib2) + (libraries unix)) diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib2/lib2.ml b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib2/lib2.ml new file mode 100644 index 000000000000..e206be29b61b --- /dev/null +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps-5.2.t/src/lib2/lib2.ml @@ -0,0 +1,3 @@ +type t = bool + +type r = Unix.error \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/dune-project b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/dune-project index f390b5360ef0..fff9b78b8427 100644 --- a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/dune-project +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/dune-project @@ -1,2 +1,2 @@ -(lang dune 2.0) -(implicit_transitive_deps false) \ No newline at end of file +(lang dune 3.17) +(implicit_transitive_deps false) diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/run.t b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/run.t index 6673d7da4098..da37e048b603 100644 --- a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/run.t +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/run.t @@ -3,7 +3,7 @@ $ dune build @check -FIXME: Merlin must be able to locate the definitions of values coming from an +Merlin must be able to locate the definitions of values coming from an implicit transitive dependency, even when `implicit-transitive-dependency` is set to `false`. They should be part of the source path returned by the configuration. @@ -11,23 +11,30 @@ configuration. In this test the dependencies are as follow: main -> lib1 -> lib2 -> stdlib +When using OCaml < 5.2 there is no proper way to provide that information to +Merlin. $ FILE=$PWD/bin/main.ml $ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin | - > sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep ":S?" + > sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?" + ?:B?:$TESTCASE_ROOT/_build/default/bin/.main.eobjs/byte) + ?:B?:$TESTCASE_ROOT/_build/default/src/lib1/.lib1.objs/byte) ?:S?:$TESTCASE_ROOT/bin) ?:S?:$TESTCASE_ROOT/src/lib1) - ?:S?:$TESTCASE_ROOT/src/lib2) - ?:S?:$TESTCASE_ROOT/src/lib_dep) $ FILE=$PWD/src/lib1/lib1.ml $ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin | - > sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep ":S?" + > sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?" + ?:B?:$TESTCASE_ROOT/_build/default/src/lib1/.lib1.objs/byte) + ?:B?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte) ?:S?:$TESTCASE_ROOT/src/lib1) ?:S?:$TESTCASE_ROOT/src/lib2) ?:S?:$TESTCASE_ROOT/src/lib_dep) $ FILE=$PWD/src/lib2/lib2.ml $ printf "(4:File%d:%s)" ${#FILE} $FILE | dune ocaml-merlin | - > sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep ":S?" + > sed -E "s/[[:digit:]]+:/\?:/g" | tr '(' '\n' | grep -E ":[BS]H?\?" + ?:B?:/STDLIB) + ?:B?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte) + ?:S?:/STDLIB) ?:S?:$TESTCASE_ROOT/src/lib2) ?:S?:$TESTCASE_ROOT/src/lib_dep)