From 75979a2615a6a8b11773dcd8b09057cd6c6b0cd3 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 01/11] 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 edc6a78487d..5c9d0ff6616 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 5db0c2b7154..4edef02046d 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 f3a456459a6..80e1665af21 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 742ba34570a..19cfb2f864a 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 57f92caa22c..8f89938f0cc 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 bd374865ffd..30732e0a3cc 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 00000000000..7f57e46dfb5 --- /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 00000000000..2f5fb3b592d --- /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 00000000000..fff9b78b842 --- /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 00000000000..f103b7e807f --- /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 00000000000..659f51cccfa --- /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 00000000000..8b4941c18c6 --- /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 00000000000..eba0287a9dd --- /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 00000000000..e206be29b61 --- /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 f390b5360ef..fff9b78b842 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 6673d7da409..da37e048b60 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) From 415c35ccff311d023408a4640c0994ad509dcefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Fri, 4 Oct 2024 18:19:19 +0200 Subject: [PATCH 02/11] Promote test results for OCaml 5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulysse Gérard --- .../test-cases/merlin/implicit-transitive-deps.t/bin/main.ml | 2 +- .../test-cases/merlin/implicit-transitive-deps.t/run.t | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/bin/main.ml b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/bin/main.ml index 2f5fb3b592d..cf8e7bb1fbb 100644 --- a/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/bin/main.ml +++ b/test/blackbox-tests/test-cases/merlin/implicit-transitive-deps.t/bin/main.ml @@ -1 +1 @@ -type t = Lib1.t \ No newline at end of file +type _t = Lib1.t 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 da37e048b60..a38c92adc49 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 @@ -28,13 +28,11 @@ Merlin. ?: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 -E ":[BS]H?\?" - ?:B?:/STDLIB) ?:B?:$TESTCASE_ROOT/_build/default/src/lib2/.lib2.objs/byte) - ?:S?:/STDLIB) + ?:B?:$TESTCASE_ROOT/_build/default/src/lib_dep/.dep.objs/byte) ?:S?:$TESTCASE_ROOT/src/lib2) ?:S?:$TESTCASE_ROOT/src/lib_dep) From b1a54008e63fbaabf006a9c1ac65893806426729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Mon, 7 Oct 2024 16:53:03 +0200 Subject: [PATCH 03/11] fmt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulysse Gérard --- test/blackbox-tests/test-cases/merlin/dune | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/blackbox-tests/test-cases/merlin/dune b/test/blackbox-tests/test-cases/merlin/dune index 30732e0a3cc..5dc72a5560e 100644 --- a/test/blackbox-tests/test-cases/merlin/dune +++ b/test/blackbox-tests/test-cases/merlin/dune @@ -12,8 +12,10 @@ (cram (applies_to implicit-transitive-deps) - (enabled_if (< %{ocaml_version} 5.2))) + (enabled_if + (< %{ocaml_version} 5.2))) (cram (applies_to implicit-transitive-deps-5.2) - (enabled_if (>= %{ocaml_version} 5.2))) + (enabled_if + (>= %{ocaml_version} 5.2))) From fe4819f5d573e02107bf916704d607467234095c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Wed, 9 Oct 2024 13:36:24 +0200 Subject: [PATCH 04/11] Promote changed tests backtraces. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulysse Gérard --- .../test-cases/deprecated-library-name/features.t | 3 +-- .../test-cases/enabled_if/eif-context_name.t/run.t | 3 +-- .../test-cases/enabled_if/eif-ocaml_version.t/run.t | 3 +-- .../test-cases/enabled_if/eif-simple.t/run.t | 1 + test/blackbox-tests/test-cases/exec-missing.t/run.t | 1 + test/blackbox-tests/test-cases/forbidden_libraries.t | 3 +-- .../blackbox-tests/test-cases/invalid-dune-package.t | 3 +-- test/blackbox-tests/test-cases/optional-executable.t | 12 ++++-------- test/blackbox-tests/test-cases/overlapping-deps.t | 5 ++--- ...ocamlformat-dev-tool-deps-conflict-project-deps.t | 3 +-- .../test-cases/ppx/ppx-runtime-dependencies.t/run.t | 3 +-- .../virtual-libraries/double-implementation.t/run.t | 1 + .../test-cases/virtual-libraries/github2896.t | 7 +++---- .../virtual-libraries/missing-implementation.t/run.t | 1 + .../virtual-modules-excluded-by-modules-field.t | 3 +-- .../vlib-wrong-default-impl.t/run.t | 3 +-- 16 files changed, 22 insertions(+), 33 deletions(-) diff --git a/test/blackbox-tests/test-cases/deprecated-library-name/features.t b/test/blackbox-tests/test-cases/deprecated-library-name/features.t index 3416bd29daa..5d826871ca4 100644 --- a/test/blackbox-tests/test-cases/deprecated-library-name/features.t +++ b/test/blackbox-tests/test-cases/deprecated-library-name/features.t @@ -96,8 +96,7 @@ that wasn't found: 1 | (executable (name prog) (libraries a)) ^ Error: Library "a" not found. - -> required by _build/default/c/.prog.eobjs/byte/dune__exe__Prog.cmi - -> required by _build/default/c/.prog.eobjs/native/dune__exe__Prog.cmx + -> required by _build/default/c/.merlin-conf/exe-prog -> required by _build/default/c/prog.exe [1] diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-context_name.t/run.t b/test/blackbox-tests/test-cases/enabled_if/eif-context_name.t/run.t index b35f3c2886b..cf92d493de6 100644 --- a/test/blackbox-tests/test-cases/enabled_if/eif-context_name.t/run.t +++ b/test/blackbox-tests/test-cases/enabled_if/eif-context_name.t/run.t @@ -34,8 +34,7 @@ dune >= 2.8 18 | (libraries bar)) ^^^ Error: Library "bar" in _build/default is hidden (unsatisfied 'enabled_if'). - -> required by _build/default/.bar_exe.eobjs/byte/dune__exe__Bar_exe.cmi - -> required by _build/default/.bar_exe.eobjs/native/dune__exe__Bar_exe.cmx + -> required by _build/default/.merlin-conf/exe-bar_exe -> required by _build/default/bar_exe.exe [1] diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-ocaml_version.t/run.t b/test/blackbox-tests/test-cases/enabled_if/eif-ocaml_version.t/run.t index a604bbb08d5..21ee608cca8 100644 --- a/test/blackbox-tests/test-cases/enabled_if/eif-ocaml_version.t/run.t +++ b/test/blackbox-tests/test-cases/enabled_if/eif-ocaml_version.t/run.t @@ -10,7 +10,6 @@ This one is disabled (version too low) ^^^^^^^^^^ Error: Library "futurecaml" in _build/default is hidden (unsatisfied 'enabled_if'). - -> required by _build/default/.main2.eobjs/byte/dune__exe__Main2.cmi - -> required by _build/default/.main2.eobjs/native/dune__exe__Main2.cmx + -> required by _build/default/.merlin-conf/exe-main2 -> required by _build/default/main2.exe [1] diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-simple.t/run.t b/test/blackbox-tests/test-cases/enabled_if/eif-simple.t/run.t index d0f07cbe00a..cf66be46c43 100644 --- a/test/blackbox-tests/test-cases/enabled_if/eif-simple.t/run.t +++ b/test/blackbox-tests/test-cases/enabled_if/eif-simple.t/run.t @@ -30,5 +30,6 @@ Test the enabled_if field for libraries: Error: Library "foo" in _build/default is hidden (unsatisfied 'enabled_if'). -> required by library "bar" in _build/default -> required by executable main in dune:44 + -> required by _build/default/.merlin-conf/exe-main -> required by _build/default/main.exe [1] diff --git a/test/blackbox-tests/test-cases/exec-missing.t/run.t b/test/blackbox-tests/test-cases/exec-missing.t/run.t index c679a3aa281..bd807ea8487 100644 --- a/test/blackbox-tests/test-cases/exec-missing.t/run.t +++ b/test/blackbox-tests/test-cases/exec-missing.t/run.t @@ -5,5 +5,6 @@ When using dune exec, the external-lib-deps command refers to the executable: 3 | (libraries does-not-exist)) ^^^^^^^^^^^^^^ Error: Library "does-not-exist" not found. + -> required by _build/default/.merlin-conf/exe-x -> required by _build/default/x.exe [1] diff --git a/test/blackbox-tests/test-cases/forbidden_libraries.t b/test/blackbox-tests/test-cases/forbidden_libraries.t index a92a7aec004..d774cb4e77c 100644 --- a/test/blackbox-tests/test-cases/forbidden_libraries.t +++ b/test/blackbox-tests/test-cases/forbidden_libraries.t @@ -24,7 +24,6 @@ Test the `forbidden_libraries` feature -> required by library "b" in _build/default -> required by library "c" in _build/default -> required by executable main in dune:5 - -> required by _build/default/.main.eobjs/byte/dune__exe__Main.cmi - -> required by _build/default/.main.eobjs/native/dune__exe__Main.cmx + -> required by _build/default/.merlin-conf/exe-main -> required by _build/default/main.exe [1] diff --git a/test/blackbox-tests/test-cases/invalid-dune-package.t b/test/blackbox-tests/test-cases/invalid-dune-package.t index 68874fdf6ab..350cad878a3 100644 --- a/test/blackbox-tests/test-cases/invalid-dune-package.t +++ b/test/blackbox-tests/test-cases/invalid-dune-package.t @@ -17,7 +17,6 @@ Now we attempt to use an invalid dune-package library: $ OCAMLPATH=$PWD/findlib dune exec ./foo.exe File "$TESTCASE_ROOT/findlib/baz/dune-package", line 1, characters 0-0: Error: Invalid first line, expected: (lang ) - -> required by _build/default/.foo.eobjs/byte/dune__exe__Foo.cmi - -> required by _build/default/.foo.eobjs/native/dune__exe__Foo.cmx + -> required by _build/default/.merlin-conf/exe-foo -> required by _build/default/foo.exe [1] diff --git a/test/blackbox-tests/test-cases/optional-executable.t b/test/blackbox-tests/test-cases/optional-executable.t index 640b562d224..c70ae3e02b0 100644 --- a/test/blackbox-tests/test-cases/optional-executable.t +++ b/test/blackbox-tests/test-cases/optional-executable.t @@ -26,8 +26,7 @@ Test optional executable 3 | (libraries does-not-exist) ^^^^^^^^^^^^^^ Error: Library "does-not-exist" not found. - -> required by _build/default/.x.eobjs/byte/dune__exe__X.cmi - -> required by _build/default/.x.eobjs/native/dune__exe__X.cmx + -> required by _build/default/.merlin-conf/exe-x -> required by _build/default/x.exe -> required by alias all [1] @@ -37,8 +36,7 @@ Test optional executable 3 | (libraries does-not-exist) ^^^^^^^^^^^^^^ Error: Library "does-not-exist" not found. - -> required by _build/default/.x.eobjs/byte/dune__exe__X.cmi - -> required by _build/default/.x.eobjs/native/dune__exe__X.cmx + -> required by _build/default/.merlin-conf/exe-x -> required by _build/default/x.exe -> required by %{exe:x.exe} at dune:8 -> required by alias run-x in dune:6 @@ -60,8 +58,7 @@ The following command should fail because the executable is not optional: 3 | (libraries does-not-exist)) ^^^^^^^^^^^^^^ Error: Library "does-not-exist" not found. - -> required by _build/default/.x.eobjs/byte/dune__exe__X.cmi - -> required by _build/default/.x.eobjs/native/dune__exe__X.cmx + -> required by _build/default/.merlin-conf/exe-x -> required by _build/default/x.exe -> required by _build/install/default/bin/x -> required by _build/default/x.install @@ -152,8 +149,7 @@ present even if the binary is not optional. 3 | (libraries doesnotexistatall) ^^^^^^^^^^^^^^^^^ Error: Library "doesnotexistatall" not found. - -> required by _build/default/exe/.bar.eobjs/byte/dune__exe__Bar.cmi - -> required by _build/default/exe/.bar.eobjs/native/dune__exe__Bar.cmx + -> required by _build/default/exe/.merlin-conf/exe-bar -> required by _build/default/exe/bar.exe -> required by _build/install/default/bin/dunetestbar -> required by %{bin:dunetestbar} at dune:3 diff --git a/test/blackbox-tests/test-cases/overlapping-deps.t b/test/blackbox-tests/test-cases/overlapping-deps.t index e2d80c2442f..6fc73cb15b1 100644 --- a/test/blackbox-tests/test-cases/overlapping-deps.t +++ b/test/blackbox-tests/test-cases/overlapping-deps.t @@ -67,7 +67,7 @@ And we see the error: $TESTCASE_ROOT/use/../external/_build/install/default/lib/some_package2 -> required by library "some_package1" in $TESTCASE_ROOT/use/../external/_build/install/default/lib/some_package1 - -> required by _build/default/proj2/.bar.objs/byte/bar.cmo + -> required by _build/default/proj2/.merlin-conf/lib-bar -> required by _build/default/proj2/bar.cma -> required by %{cma:proj2/bar} at command line:1 [1] @@ -106,7 +106,6 @@ We also make sure the error exists for executables: -> required by library "some_package1" in $TESTCASE_ROOT/use/../external/_build/install/default/lib/some_package1 -> required by executable bar in proj2/dune:2 - -> required by _build/default/proj2/.bar.eobjs/byte/dune__exe__Bar.cmi - -> required by _build/default/proj2/.bar.eobjs/native/dune__exe__Bar.cmx + -> required by _build/default/proj2/.merlin-conf/exe-bar -> required by _build/default/proj2/bar.exe [1] diff --git a/test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-dev-tool-deps-conflict-project-deps.t b/test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-dev-tool-deps-conflict-project-deps.t index 645e741baf1..8dde4bd3473 100644 --- a/test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-dev-tool-deps-conflict-project-deps.t +++ b/test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-dev-tool-deps-conflict-project-deps.t @@ -126,8 +126,7 @@ There is no leak here. It is not taking the "printer" lib from dev-tools. 3 | (libraries printer)) ^^^^^^^ Error: Library "printer" not found. - -> required by _build/default/.foo.eobjs/byte/dune__exe__Foo.cmi - -> required by _build/default/.foo.eobjs/native/dune__exe__Foo.cmx + -> required by _build/default/.merlin-conf/exe-foo -> required by _build/default/foo.exe -> required by _build/install/default/bin/foo [1] diff --git a/test/blackbox-tests/test-cases/ppx/ppx-runtime-dependencies.t/run.t b/test/blackbox-tests/test-cases/ppx/ppx-runtime-dependencies.t/run.t index d0796bcfd73..547478a2616 100644 --- a/test/blackbox-tests/test-cases/ppx/ppx-runtime-dependencies.t/run.t +++ b/test/blackbox-tests/test-cases/ppx/ppx-runtime-dependencies.t/run.t @@ -114,8 +114,7 @@ not been marked with (kind ppx_rewriter). ^ Error: Ppx dependency on a non-ppx library "b". If "b" is in fact a ppx rewriter library, it should have (kind ppx_rewriter) in its dune file. - -> required by _build/default/bin/.main.eobjs/byte/dune__exe__Main.cmi - -> required by _build/default/bin/.main.eobjs/native/dune__exe__Main.cmx + -> required by _build/default/bin/.merlin-conf/exe-main -> required by _build/default/bin/main.exe [1] diff --git a/test/blackbox-tests/test-cases/virtual-libraries/double-implementation.t/run.t b/test/blackbox-tests/test-cases/virtual-libraries/double-implementation.t/run.t index 25a90548ffd..830e6358ba0 100644 --- a/test/blackbox-tests/test-cases/virtual-libraries/double-implementation.t/run.t +++ b/test/blackbox-tests/test-cases/virtual-libraries/double-implementation.t/run.t @@ -7,6 +7,7 @@ Executable that tries to use two implementations for the same virtual lib - "impl2" in _build/default/impl2 This cannot work. -> required by executable foo in dune:2 + -> required by _build/default/.merlin-conf/exe-foo -> required by _build/default/foo.exe -> required by alias default in dune:11 [1] diff --git a/test/blackbox-tests/test-cases/virtual-libraries/github2896.t b/test/blackbox-tests/test-cases/virtual-libraries/github2896.t index 0292384712b..db616d0af6b 100644 --- a/test/blackbox-tests/test-cases/virtual-libraries/github2896.t +++ b/test/blackbox-tests/test-cases/virtual-libraries/github2896.t @@ -23,8 +23,8 @@ where vlib is a virtual library, and impl implements this library. Error: Library "vlib" was pulled in. -> required by library "lib" in _build/default/lib -> required by library "impl" in _build/default/impl - -> required by _build/default/impl/.impl.objs/byte/vlib.cmo - -> required by _build/default/impl/impl.cma + -> required by _build/default/impl/.merlin-conf/lib-impl + -> required by _build/default/impl/vlib__impl__.ml-gen -> required by alias impl/all [1] @@ -37,7 +37,6 @@ The implementation impl was built, but it's not usable: -> required by library "lib" in _build/default/lib -> required by library "impl" in _build/default/impl -> required by executable foo in dune:1 - -> required by _build/default/.foo.eobjs/byte/dune__exe__Foo.cmi - -> required by _build/default/.foo.eobjs/native/dune__exe__Foo.cmx + -> required by _build/default/.merlin-conf/exe-foo -> required by _build/default/foo.exe [1] diff --git a/test/blackbox-tests/test-cases/virtual-libraries/missing-implementation.t/run.t b/test/blackbox-tests/test-cases/virtual-libraries/missing-implementation.t/run.t index ea95323aacb..d1a0203ee71 100644 --- a/test/blackbox-tests/test-cases/virtual-libraries/missing-implementation.t/run.t +++ b/test/blackbox-tests/test-cases/virtual-libraries/missing-implementation.t/run.t @@ -3,6 +3,7 @@ Executable that tries to build against a virtual library without an implementati Error: No implementation found for virtual library "vlib" in _build/default/vlib. -> required by executable foo in dune:2 + -> required by _build/default/.merlin-conf/exe-foo -> required by _build/default/foo.exe -> required by alias default in dune:5 [1] diff --git a/test/blackbox-tests/test-cases/virtual-libraries/virtual-modules-excluded-by-modules-field.t b/test/blackbox-tests/test-cases/virtual-libraries/virtual-modules-excluded-by-modules-field.t index 3598ec20698..454cd8e3ea2 100644 --- a/test/blackbox-tests/test-cases/virtual-libraries/virtual-modules-excluded-by-modules-field.t +++ b/test/blackbox-tests/test-cases/virtual-libraries/virtual-modules-excluded-by-modules-field.t @@ -76,7 +76,6 @@ This should be ignored if we are in vendored_dirs Error: No implementation found for virtual library "foo" in _build/default/src. -> required by executable bar in dune:3 - -> required by _build/default/.bar.eobjs/byte/dune__exe__Bar.cmi - -> required by _build/default/.bar.eobjs/native/dune__exe__Bar.cmx + -> required by _build/default/.merlin-conf/exe-bar -> required by _build/default/bar.exe [1] diff --git a/test/blackbox-tests/test-cases/virtual-libraries/vlib-wrong-default-impl.t/run.t b/test/blackbox-tests/test-cases/virtual-libraries/vlib-wrong-default-impl.t/run.t index 772372a657c..ce661aece29 100644 --- a/test/blackbox-tests/test-cases/virtual-libraries/vlib-wrong-default-impl.t/run.t +++ b/test/blackbox-tests/test-cases/virtual-libraries/vlib-wrong-default-impl.t/run.t @@ -4,8 +4,7 @@ library is not actually an implementation of the virtual library. $ dune build @default Error: "not_an_implem" is not an implementation of "vlibfoo". -> required by executable exe in exe/dune:2 - -> required by _build/default/exe/.exe.eobjs/byte/dune__exe__Exe.cmi - -> required by _build/default/exe/.exe.eobjs/native/dune__exe__Exe.cmx + -> required by _build/default/exe/.merlin-conf/exe-exe -> required by _build/default/exe/exe.exe -> required by alias exe/default in exe/dune:5 [1] From 75ade1bd57eaf405cf293c3879a3137574f7fa2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Wed, 9 Oct 2024 13:37:59 +0200 Subject: [PATCH 05/11] Bump Merlin conf version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulysse Gérard --- src/dune_rules/merlin/merlin.ml | 2 +- test/expect-tests/persistent_tests.ml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dune_rules/merlin/merlin.ml b/src/dune_rules/merlin/merlin.ml index 19cfb2f864a..ab31744ef1f 100644 --- a/src/dune_rules/merlin/merlin.ml +++ b/src/dune_rules/merlin/merlin.ml @@ -119,7 +119,7 @@ module Processed = struct type nonrec t = t let name = "merlin-conf" - let version = 5 + let version = 6 let to_dyn _ = Dyn.String "Use [dune ocaml dump-dot-merlin] instead" let test_example () = diff --git a/test/expect-tests/persistent_tests.ml b/test/expect-tests/persistent_tests.ml index 7f386431cc6..159f9993c1a 100644 --- a/test/expect-tests/persistent_tests.ml +++ b/test/expect-tests/persistent_tests.ml @@ -43,8 +43,8 @@ let%expect_test "persistent digests" = 7dac5b11f6f654bb6f230392493b363f --- - merlin-conf version 5 - 49e3a1010b7218f5b229d98991d6d11d + merlin-conf version 6 + 880477921df9a8915d57c0e8bdfb2fc1 --- INCREMENTAL-DB version 5 From 2f436efbe9f3832ddcd800844a77201ddf9d7af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Wed, 9 Oct 2024 13:59:28 +0200 Subject: [PATCH 06/11] Promote more consistent behaviour of overlap checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulysse Gérard --- test/blackbox-tests/test-cases/overlapping-deps.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/blackbox-tests/test-cases/overlapping-deps.t b/test/blackbox-tests/test-cases/overlapping-deps.t index 6fc73cb15b1..5b471d9335a 100644 --- a/test/blackbox-tests/test-cases/overlapping-deps.t +++ b/test/blackbox-tests/test-cases/overlapping-deps.t @@ -81,7 +81,7 @@ We can fix the error by allow overlapping dependencies: > EOF $ OCAMLPATH=$PWD/../external/_build/install/default/lib dune build %{cma:proj2/bar} --root . -Strangely, the error disappears if we remove the source for the bar lib: +The error does not disappears if we remove the source for the bar lib: $ cat >proj2/dune < (library @@ -90,6 +90,16 @@ Strangely, the error disappears if we remove the source for the bar lib: > EOF $ rm proj2/bar.ml $ OCAMLPATH=$PWD/../external/_build/install/default/lib dune build %{cma:proj2/bar} --root . + Error: Conflict between the following libraries: + - "some_package2" in _build/default/proj1 + - "some_package2" in + $TESTCASE_ROOT/use/../external/_build/install/default/lib/some_package2 + -> required by library "some_package1" in + $TESTCASE_ROOT/use/../external/_build/install/default/lib/some_package1 + -> required by _build/default/proj2/.merlin-conf/lib-bar + -> required by _build/default/proj2/bar.cma + -> required by %{cma:proj2/bar} at command line:1 + [1] We also make sure the error exists for executables: $ cat >proj2/dune < Date: Wed, 9 Oct 2024 18:23:26 +0200 Subject: [PATCH 07/11] Merlin: Remove unused `source_dirs` argument. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulysse Gérard --- src/dune_rules/exe_rules.ml | 1 - src/dune_rules/lib_rules.ml | 1 - src/dune_rules/melange/melange_rules.ml | 1 - src/dune_rules/merlin/merlin.ml | 33 +++++++++++-------------- src/dune_rules/merlin/merlin.mli | 1 - 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/dune_rules/exe_rules.ml b/src/dune_rules/exe_rules.ml index 5c9d0ff6616..c3de011f3af 100644 --- a/src/dune_rules/exe_rules.ml +++ b/src/dune_rules/exe_rules.ml @@ -286,7 +286,6 @@ let executables_rules ~stdlib_dir ~flags ~modules - ~source_dirs:Path.Source.Set.empty ~libname:None ~obj_dir ~preprocess: diff --git a/src/dune_rules/lib_rules.ml b/src/dune_rules/lib_rules.ml index 4edef02046d..9893e17dd8f 100644 --- a/src/dune_rules/lib_rules.ml +++ b/src/dune_rules/lib_rules.ml @@ -633,7 +633,6 @@ let library_rules ~stdlib_dir ~flags ~modules - ~source_dirs:Path.Source.Set.empty ~preprocess:(Preprocess.Per_module.without_instrumentation lib.buildable.preprocess) ~libname:(Some (snd lib.name)) ~obj_dir diff --git a/src/dune_rules/melange/melange_rules.ml b/src/dune_rules/melange/melange_rules.ml index 80e1665af21..8f75c43708b 100644 --- a/src/dune_rules/melange/melange_rules.ml +++ b/src/dune_rules/melange/melange_rules.ml @@ -360,7 +360,6 @@ let setup_emit_cmj_rules ~stdlib_dir ~flags ~modules - ~source_dirs:Path.Source.Set.empty ~libname:None ~preprocess:(Preprocess.Per_module.without_instrumentation mel.preprocess) ~obj_dir diff --git a/src/dune_rules/merlin/merlin.ml b/src/dune_rules/merlin/merlin.ml index ab31744ef1f..a5ea9f97746 100644 --- a/src/dune_rules/merlin/merlin.ml +++ b/src/dune_rules/merlin/merlin.ml @@ -464,7 +464,6 @@ module Unprocessed = struct ; preprocess : Preprocess.Without_instrumentation.t Preprocess.t Module_name.Per_item.t ; libname : Lib_name.Local.t option - ; source_dirs : Path.Source.Set.t ; objs_dirs : Path.Set.t ; extensions : string option Ml_kind.Dict.t list ; readers : string list String.Map.t @@ -484,7 +483,6 @@ module Unprocessed = struct ~flags ~preprocess ~libname - ~source_dirs ~modules ~obj_dir ~dialects @@ -511,7 +509,6 @@ module Unprocessed = struct ; flags ; preprocess ; libname - ; source_dirs ; objs_dirs ; extensions ; readers @@ -613,19 +610,21 @@ module Unprocessed = struct ~f:(pp_flags ctx ~expander t.config.libname) ;; - let add_lib_dirs sctx mode ~init libs = + let add_lib_dirs sctx mode 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 ))) + >>| List.fold_left + ~init:(Path.Set.empty, Path.Set.empty) + ~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 @@ -637,7 +636,6 @@ module Unprocessed = struct ; readers ; flags ; objs_dirs - ; source_dirs ; requires_compile ; requires_hidden ; preprocess = _ @@ -692,15 +690,12 @@ module Unprocessed = struct in let+ flags = flags and+ indexes = Action_builder.of_memo (Ocaml_index.context_indexes sctx) - and+ src_dirs, obj_dirs = - 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 + and+ deps_src_dirs, deps_obj_dirs = add_lib_dirs sctx mode requires_compile + and+ hidden_src_dirs, hidden_obj_dirs = add_lib_dirs sctx mode requires_hidden in let src_dirs = - Path.Set.union src_dirs (Path.Set.of_list_map ~f:Path.source more_src_dirs) + Path.Set.of_list_map ~f:Path.source more_src_dirs |> Path.Set.union deps_src_dirs in + let obj_dirs = Path.Set.union deps_obj_dirs objs_dirs in let source_root = Path.Source.root |> Path.source in { Processed.stdlib_dir ; source_root diff --git a/src/dune_rules/merlin/merlin.mli b/src/dune_rules/merlin/merlin.mli index 8f89938f0cc..f063f1f8397 100644 --- a/src/dune_rules/merlin/merlin.mli +++ b/src/dune_rules/merlin/merlin.mli @@ -47,7 +47,6 @@ val make -> flags:Ocaml_flags.t -> preprocess:Preprocess.Without_instrumentation.t Preprocess.t Module_name.Per_item.t -> libname:Lib_name.Local.t option - -> source_dirs:Path.Source.Set.t -> modules:Modules.With_vlib.t -> obj_dir:Path.Build.t Obj_dir.t -> dialects:Dialect.DB.t From 775915d456c218f514370a1d692804987c00436e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Thu, 10 Oct 2024 16:21:28 +0200 Subject: [PATCH 08/11] Add changelog entry for #10535 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulysse Gérard --- doc/changes/10535.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 doc/changes/10535.md diff --git a/doc/changes/10535.md b/doc/changes/10535.md new file mode 100644 index 00000000000..0dd623b601a --- /dev/null +++ b/doc/changes/10535.md @@ -0,0 +1,2 @@ +- Use Merlin new configuration directives `BH` and `SH` for hidden dependencies. + (#10535, @voodoos) From 2350eab0588969cbbdfcade826c935b024f28dcf Mon Sep 17 00:00:00 2001 From: Ulysse <5031221+voodoos@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:36:58 +0200 Subject: [PATCH 09/11] Fixect typo Co-authored-by: Marek Kubica Signed-off-by: Ulysse <5031221+voodoos@users.noreply.github.com> --- test/blackbox-tests/test-cases/overlapping-deps.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/blackbox-tests/test-cases/overlapping-deps.t b/test/blackbox-tests/test-cases/overlapping-deps.t index 5b471d9335a..d6a0bd38049 100644 --- a/test/blackbox-tests/test-cases/overlapping-deps.t +++ b/test/blackbox-tests/test-cases/overlapping-deps.t @@ -81,7 +81,7 @@ We can fix the error by allow overlapping dependencies: > EOF $ OCAMLPATH=$PWD/../external/_build/install/default/lib dune build %{cma:proj2/bar} --root . -The error does not disappears if we remove the source for the bar lib: +The error does not disappear if we remove the source for the bar lib: $ cat >proj2/dune < (library From 6d113f5c2ef497bf5617d8fc09de945075cfa89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Thu, 10 Oct 2024 17:01:19 +0200 Subject: [PATCH 10/11] Only peek at dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulysse Gérard --- src/dune_rules/merlin/merlin.ml | 4 ++-- .../deprecated-library-name/features.t | 3 ++- .../enabled_if/eif-context_name.t/run.t | 3 ++- .../enabled_if/eif-ocaml_version.t/run.t | 3 ++- .../test-cases/enabled_if/eif-simple.t/run.t | 1 - .../test-cases/exec-missing.t/run.t | 1 - .../test-cases/forbidden_libraries.t | 3 ++- .../test-cases/invalid-dune-package.t | 3 ++- .../test-cases/optional-executable.t | 12 ++++++++---- .../test-cases/overlapping-deps.t | 17 ++++------------- ...format-dev-tool-deps-conflict-project-deps.t | 3 ++- .../ppx/ppx-runtime-dependencies.t/run.t | 3 ++- .../double-implementation.t/run.t | 1 - .../test-cases/virtual-libraries/github2896.t | 7 ++++--- .../missing-implementation.t/run.t | 1 - .../virtual-modules-excluded-by-modules-field.t | 3 ++- .../vlib-wrong-default-impl.t/run.t | 3 ++- 17 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/dune_rules/merlin/merlin.ml b/src/dune_rules/merlin/merlin.ml index a5ea9f97746..dc7641b2a80 100644 --- a/src/dune_rules/merlin/merlin.ml +++ b/src/dune_rules/merlin/merlin.ml @@ -662,8 +662,8 @@ module Unprocessed = struct | [] -> None | stdlib_dir :: _ -> Some stdlib_dir) in - let* requires_compile = Resolve.read requires_compile in - let* requires_hidden = Resolve.read requires_hidden in + let requires_compile = Resolve.peek requires_compile |> Result.value ~default:[] in + let requires_hidden = Resolve.peek requires_hidden |> Result.value ~default:[] in let* requires_compile, requires_hidden = match t.config.mode with | Ocaml _ -> Action_builder.return (requires_compile, requires_hidden) diff --git a/test/blackbox-tests/test-cases/deprecated-library-name/features.t b/test/blackbox-tests/test-cases/deprecated-library-name/features.t index 5d826871ca4..3416bd29daa 100644 --- a/test/blackbox-tests/test-cases/deprecated-library-name/features.t +++ b/test/blackbox-tests/test-cases/deprecated-library-name/features.t @@ -96,7 +96,8 @@ that wasn't found: 1 | (executable (name prog) (libraries a)) ^ Error: Library "a" not found. - -> required by _build/default/c/.merlin-conf/exe-prog + -> required by _build/default/c/.prog.eobjs/byte/dune__exe__Prog.cmi + -> required by _build/default/c/.prog.eobjs/native/dune__exe__Prog.cmx -> required by _build/default/c/prog.exe [1] diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-context_name.t/run.t b/test/blackbox-tests/test-cases/enabled_if/eif-context_name.t/run.t index cf92d493de6..b35f3c2886b 100644 --- a/test/blackbox-tests/test-cases/enabled_if/eif-context_name.t/run.t +++ b/test/blackbox-tests/test-cases/enabled_if/eif-context_name.t/run.t @@ -34,7 +34,8 @@ dune >= 2.8 18 | (libraries bar)) ^^^ Error: Library "bar" in _build/default is hidden (unsatisfied 'enabled_if'). - -> required by _build/default/.merlin-conf/exe-bar_exe + -> required by _build/default/.bar_exe.eobjs/byte/dune__exe__Bar_exe.cmi + -> required by _build/default/.bar_exe.eobjs/native/dune__exe__Bar_exe.cmx -> required by _build/default/bar_exe.exe [1] diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-ocaml_version.t/run.t b/test/blackbox-tests/test-cases/enabled_if/eif-ocaml_version.t/run.t index 21ee608cca8..a604bbb08d5 100644 --- a/test/blackbox-tests/test-cases/enabled_if/eif-ocaml_version.t/run.t +++ b/test/blackbox-tests/test-cases/enabled_if/eif-ocaml_version.t/run.t @@ -10,6 +10,7 @@ This one is disabled (version too low) ^^^^^^^^^^ Error: Library "futurecaml" in _build/default is hidden (unsatisfied 'enabled_if'). - -> required by _build/default/.merlin-conf/exe-main2 + -> required by _build/default/.main2.eobjs/byte/dune__exe__Main2.cmi + -> required by _build/default/.main2.eobjs/native/dune__exe__Main2.cmx -> required by _build/default/main2.exe [1] diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-simple.t/run.t b/test/blackbox-tests/test-cases/enabled_if/eif-simple.t/run.t index cf66be46c43..d0f07cbe00a 100644 --- a/test/blackbox-tests/test-cases/enabled_if/eif-simple.t/run.t +++ b/test/blackbox-tests/test-cases/enabled_if/eif-simple.t/run.t @@ -30,6 +30,5 @@ Test the enabled_if field for libraries: Error: Library "foo" in _build/default is hidden (unsatisfied 'enabled_if'). -> required by library "bar" in _build/default -> required by executable main in dune:44 - -> required by _build/default/.merlin-conf/exe-main -> required by _build/default/main.exe [1] diff --git a/test/blackbox-tests/test-cases/exec-missing.t/run.t b/test/blackbox-tests/test-cases/exec-missing.t/run.t index bd807ea8487..c679a3aa281 100644 --- a/test/blackbox-tests/test-cases/exec-missing.t/run.t +++ b/test/blackbox-tests/test-cases/exec-missing.t/run.t @@ -5,6 +5,5 @@ When using dune exec, the external-lib-deps command refers to the executable: 3 | (libraries does-not-exist)) ^^^^^^^^^^^^^^ Error: Library "does-not-exist" not found. - -> required by _build/default/.merlin-conf/exe-x -> required by _build/default/x.exe [1] diff --git a/test/blackbox-tests/test-cases/forbidden_libraries.t b/test/blackbox-tests/test-cases/forbidden_libraries.t index d774cb4e77c..a92a7aec004 100644 --- a/test/blackbox-tests/test-cases/forbidden_libraries.t +++ b/test/blackbox-tests/test-cases/forbidden_libraries.t @@ -24,6 +24,7 @@ Test the `forbidden_libraries` feature -> required by library "b" in _build/default -> required by library "c" in _build/default -> required by executable main in dune:5 - -> required by _build/default/.merlin-conf/exe-main + -> required by _build/default/.main.eobjs/byte/dune__exe__Main.cmi + -> required by _build/default/.main.eobjs/native/dune__exe__Main.cmx -> required by _build/default/main.exe [1] diff --git a/test/blackbox-tests/test-cases/invalid-dune-package.t b/test/blackbox-tests/test-cases/invalid-dune-package.t index 350cad878a3..68874fdf6ab 100644 --- a/test/blackbox-tests/test-cases/invalid-dune-package.t +++ b/test/blackbox-tests/test-cases/invalid-dune-package.t @@ -17,6 +17,7 @@ Now we attempt to use an invalid dune-package library: $ OCAMLPATH=$PWD/findlib dune exec ./foo.exe File "$TESTCASE_ROOT/findlib/baz/dune-package", line 1, characters 0-0: Error: Invalid first line, expected: (lang ) - -> required by _build/default/.merlin-conf/exe-foo + -> required by _build/default/.foo.eobjs/byte/dune__exe__Foo.cmi + -> required by _build/default/.foo.eobjs/native/dune__exe__Foo.cmx -> required by _build/default/foo.exe [1] diff --git a/test/blackbox-tests/test-cases/optional-executable.t b/test/blackbox-tests/test-cases/optional-executable.t index c70ae3e02b0..640b562d224 100644 --- a/test/blackbox-tests/test-cases/optional-executable.t +++ b/test/blackbox-tests/test-cases/optional-executable.t @@ -26,7 +26,8 @@ Test optional executable 3 | (libraries does-not-exist) ^^^^^^^^^^^^^^ Error: Library "does-not-exist" not found. - -> required by _build/default/.merlin-conf/exe-x + -> required by _build/default/.x.eobjs/byte/dune__exe__X.cmi + -> required by _build/default/.x.eobjs/native/dune__exe__X.cmx -> required by _build/default/x.exe -> required by alias all [1] @@ -36,7 +37,8 @@ Test optional executable 3 | (libraries does-not-exist) ^^^^^^^^^^^^^^ Error: Library "does-not-exist" not found. - -> required by _build/default/.merlin-conf/exe-x + -> required by _build/default/.x.eobjs/byte/dune__exe__X.cmi + -> required by _build/default/.x.eobjs/native/dune__exe__X.cmx -> required by _build/default/x.exe -> required by %{exe:x.exe} at dune:8 -> required by alias run-x in dune:6 @@ -58,7 +60,8 @@ The following command should fail because the executable is not optional: 3 | (libraries does-not-exist)) ^^^^^^^^^^^^^^ Error: Library "does-not-exist" not found. - -> required by _build/default/.merlin-conf/exe-x + -> required by _build/default/.x.eobjs/byte/dune__exe__X.cmi + -> required by _build/default/.x.eobjs/native/dune__exe__X.cmx -> required by _build/default/x.exe -> required by _build/install/default/bin/x -> required by _build/default/x.install @@ -149,7 +152,8 @@ present even if the binary is not optional. 3 | (libraries doesnotexistatall) ^^^^^^^^^^^^^^^^^ Error: Library "doesnotexistatall" not found. - -> required by _build/default/exe/.merlin-conf/exe-bar + -> required by _build/default/exe/.bar.eobjs/byte/dune__exe__Bar.cmi + -> required by _build/default/exe/.bar.eobjs/native/dune__exe__Bar.cmx -> required by _build/default/exe/bar.exe -> required by _build/install/default/bin/dunetestbar -> required by %{bin:dunetestbar} at dune:3 diff --git a/test/blackbox-tests/test-cases/overlapping-deps.t b/test/blackbox-tests/test-cases/overlapping-deps.t index d6a0bd38049..e2d80c2442f 100644 --- a/test/blackbox-tests/test-cases/overlapping-deps.t +++ b/test/blackbox-tests/test-cases/overlapping-deps.t @@ -67,7 +67,7 @@ And we see the error: $TESTCASE_ROOT/use/../external/_build/install/default/lib/some_package2 -> required by library "some_package1" in $TESTCASE_ROOT/use/../external/_build/install/default/lib/some_package1 - -> required by _build/default/proj2/.merlin-conf/lib-bar + -> required by _build/default/proj2/.bar.objs/byte/bar.cmo -> required by _build/default/proj2/bar.cma -> required by %{cma:proj2/bar} at command line:1 [1] @@ -81,7 +81,7 @@ We can fix the error by allow overlapping dependencies: > EOF $ OCAMLPATH=$PWD/../external/_build/install/default/lib dune build %{cma:proj2/bar} --root . -The error does not disappear if we remove the source for the bar lib: +Strangely, the error disappears if we remove the source for the bar lib: $ cat >proj2/dune < (library @@ -90,16 +90,6 @@ The error does not disappear if we remove the source for the bar lib: > EOF $ rm proj2/bar.ml $ OCAMLPATH=$PWD/../external/_build/install/default/lib dune build %{cma:proj2/bar} --root . - Error: Conflict between the following libraries: - - "some_package2" in _build/default/proj1 - - "some_package2" in - $TESTCASE_ROOT/use/../external/_build/install/default/lib/some_package2 - -> required by library "some_package1" in - $TESTCASE_ROOT/use/../external/_build/install/default/lib/some_package1 - -> required by _build/default/proj2/.merlin-conf/lib-bar - -> required by _build/default/proj2/bar.cma - -> required by %{cma:proj2/bar} at command line:1 - [1] We also make sure the error exists for executables: $ cat >proj2/dune < required by library "some_package1" in $TESTCASE_ROOT/use/../external/_build/install/default/lib/some_package1 -> required by executable bar in proj2/dune:2 - -> required by _build/default/proj2/.merlin-conf/exe-bar + -> required by _build/default/proj2/.bar.eobjs/byte/dune__exe__Bar.cmi + -> required by _build/default/proj2/.bar.eobjs/native/dune__exe__Bar.cmx -> required by _build/default/proj2/bar.exe [1] diff --git a/test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-dev-tool-deps-conflict-project-deps.t b/test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-dev-tool-deps-conflict-project-deps.t index 8dde4bd3473..645e741baf1 100644 --- a/test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-dev-tool-deps-conflict-project-deps.t +++ b/test/blackbox-tests/test-cases/pkg/ocamlformat/ocamlformat-dev-tool-deps-conflict-project-deps.t @@ -126,7 +126,8 @@ There is no leak here. It is not taking the "printer" lib from dev-tools. 3 | (libraries printer)) ^^^^^^^ Error: Library "printer" not found. - -> required by _build/default/.merlin-conf/exe-foo + -> required by _build/default/.foo.eobjs/byte/dune__exe__Foo.cmi + -> required by _build/default/.foo.eobjs/native/dune__exe__Foo.cmx -> required by _build/default/foo.exe -> required by _build/install/default/bin/foo [1] diff --git a/test/blackbox-tests/test-cases/ppx/ppx-runtime-dependencies.t/run.t b/test/blackbox-tests/test-cases/ppx/ppx-runtime-dependencies.t/run.t index 547478a2616..d0796bcfd73 100644 --- a/test/blackbox-tests/test-cases/ppx/ppx-runtime-dependencies.t/run.t +++ b/test/blackbox-tests/test-cases/ppx/ppx-runtime-dependencies.t/run.t @@ -114,7 +114,8 @@ not been marked with (kind ppx_rewriter). ^ Error: Ppx dependency on a non-ppx library "b". If "b" is in fact a ppx rewriter library, it should have (kind ppx_rewriter) in its dune file. - -> required by _build/default/bin/.merlin-conf/exe-main + -> required by _build/default/bin/.main.eobjs/byte/dune__exe__Main.cmi + -> required by _build/default/bin/.main.eobjs/native/dune__exe__Main.cmx -> required by _build/default/bin/main.exe [1] diff --git a/test/blackbox-tests/test-cases/virtual-libraries/double-implementation.t/run.t b/test/blackbox-tests/test-cases/virtual-libraries/double-implementation.t/run.t index 830e6358ba0..25a90548ffd 100644 --- a/test/blackbox-tests/test-cases/virtual-libraries/double-implementation.t/run.t +++ b/test/blackbox-tests/test-cases/virtual-libraries/double-implementation.t/run.t @@ -7,7 +7,6 @@ Executable that tries to use two implementations for the same virtual lib - "impl2" in _build/default/impl2 This cannot work. -> required by executable foo in dune:2 - -> required by _build/default/.merlin-conf/exe-foo -> required by _build/default/foo.exe -> required by alias default in dune:11 [1] diff --git a/test/blackbox-tests/test-cases/virtual-libraries/github2896.t b/test/blackbox-tests/test-cases/virtual-libraries/github2896.t index db616d0af6b..0292384712b 100644 --- a/test/blackbox-tests/test-cases/virtual-libraries/github2896.t +++ b/test/blackbox-tests/test-cases/virtual-libraries/github2896.t @@ -23,8 +23,8 @@ where vlib is a virtual library, and impl implements this library. Error: Library "vlib" was pulled in. -> required by library "lib" in _build/default/lib -> required by library "impl" in _build/default/impl - -> required by _build/default/impl/.merlin-conf/lib-impl - -> required by _build/default/impl/vlib__impl__.ml-gen + -> required by _build/default/impl/.impl.objs/byte/vlib.cmo + -> required by _build/default/impl/impl.cma -> required by alias impl/all [1] @@ -37,6 +37,7 @@ The implementation impl was built, but it's not usable: -> required by library "lib" in _build/default/lib -> required by library "impl" in _build/default/impl -> required by executable foo in dune:1 - -> required by _build/default/.merlin-conf/exe-foo + -> required by _build/default/.foo.eobjs/byte/dune__exe__Foo.cmi + -> required by _build/default/.foo.eobjs/native/dune__exe__Foo.cmx -> required by _build/default/foo.exe [1] diff --git a/test/blackbox-tests/test-cases/virtual-libraries/missing-implementation.t/run.t b/test/blackbox-tests/test-cases/virtual-libraries/missing-implementation.t/run.t index d1a0203ee71..ea95323aacb 100644 --- a/test/blackbox-tests/test-cases/virtual-libraries/missing-implementation.t/run.t +++ b/test/blackbox-tests/test-cases/virtual-libraries/missing-implementation.t/run.t @@ -3,7 +3,6 @@ Executable that tries to build against a virtual library without an implementati Error: No implementation found for virtual library "vlib" in _build/default/vlib. -> required by executable foo in dune:2 - -> required by _build/default/.merlin-conf/exe-foo -> required by _build/default/foo.exe -> required by alias default in dune:5 [1] diff --git a/test/blackbox-tests/test-cases/virtual-libraries/virtual-modules-excluded-by-modules-field.t b/test/blackbox-tests/test-cases/virtual-libraries/virtual-modules-excluded-by-modules-field.t index 454cd8e3ea2..3598ec20698 100644 --- a/test/blackbox-tests/test-cases/virtual-libraries/virtual-modules-excluded-by-modules-field.t +++ b/test/blackbox-tests/test-cases/virtual-libraries/virtual-modules-excluded-by-modules-field.t @@ -76,6 +76,7 @@ This should be ignored if we are in vendored_dirs Error: No implementation found for virtual library "foo" in _build/default/src. -> required by executable bar in dune:3 - -> required by _build/default/.merlin-conf/exe-bar + -> required by _build/default/.bar.eobjs/byte/dune__exe__Bar.cmi + -> required by _build/default/.bar.eobjs/native/dune__exe__Bar.cmx -> required by _build/default/bar.exe [1] diff --git a/test/blackbox-tests/test-cases/virtual-libraries/vlib-wrong-default-impl.t/run.t b/test/blackbox-tests/test-cases/virtual-libraries/vlib-wrong-default-impl.t/run.t index ce661aece29..772372a657c 100644 --- a/test/blackbox-tests/test-cases/virtual-libraries/vlib-wrong-default-impl.t/run.t +++ b/test/blackbox-tests/test-cases/virtual-libraries/vlib-wrong-default-impl.t/run.t @@ -4,7 +4,8 @@ library is not actually an implementation of the virtual library. $ dune build @default Error: "not_an_implem" is not an implementation of "vlibfoo". -> required by executable exe in exe/dune:2 - -> required by _build/default/exe/.merlin-conf/exe-exe + -> required by _build/default/exe/.exe.eobjs/byte/dune__exe__Exe.cmi + -> required by _build/default/exe/.exe.eobjs/native/dune__exe__Exe.cmx -> required by _build/default/exe/exe.exe -> required by alias exe/default in exe/dune:5 [1] From feb1cd5cfbc665f6c4c814f89a73b7fdc6669c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ojeda=20B=C3=A4r?= Date: Fri, 11 Oct 2024 06:33:15 +0200 Subject: [PATCH 11/11] Changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolás Ojeda Bär --- doc/changes/10535.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/changes/10535.md b/doc/changes/10535.md index 0dd623b601a..7306c8a8459 100644 --- a/doc/changes/10535.md +++ b/doc/changes/10535.md @@ -1,2 +1,2 @@ -- Use Merlin new configuration directives `BH` and `SH` for hidden dependencies. - (#10535, @voodoos) +- Make Merlin/OCaml-LSP aware of "hidden" dependencies used by + `(implicit_transitive_deps false)` via the `-H` compiler flag. (#10535, @voodoos)