diff --git a/CHANGES.md b/CHANGES.md index 3163f0d1553..1f82035416f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ unreleased ---------- +- Fix merlin handling of private module visibility (#1653 @bobot) + - unstable-fmt: use boxes to wrap some lists (#1608, fix #1153, @emillon, thanks to @rgrinberg) diff --git a/src/lib_rules.ml b/src/lib_rules.ml index 51af2a1e207..3554cd27815 100644 --- a/src/lib_rules.ml +++ b/src/lib_rules.ml @@ -538,13 +538,19 @@ module Gen (P : Install_rules.Params) = struct ; compile_info }; + let objs_dirs = Path.Set.singleton obj_dir in + let objs_dirs = if Lib_modules.has_private_modules lib_modules then + Path.Set.add objs_dirs private_obj_dir + else objs_dirs in + (cctx, Merlin.make () ~requires:(Lib.Compile.requires compile_info) ~flags ~preprocess:(Buildable.single_preprocess lib.buildable) ~libname:(snd lib.name) - ~objs_dirs:(Path.Set.singleton obj_dir)) + ~objs_dirs + ) let rules (lib : Library.t) ~dir_contents ~dir ~expander ~scope ~dir_kind : Compilation_context.t * Merlin.t = diff --git a/src/merlin.ml b/src/merlin.ml index f14c03223e0..2b9aa424329 100644 --- a/src/merlin.ml +++ b/src/merlin.ml @@ -144,10 +144,7 @@ let dot_merlin sctx ~dir ~more_src_dirs ~scope ~dir_kind Lib.src_dir lib |> Path.drop_optional_build_context) , - let obj_dirs = Path.Set.add obj_dirs (Lib.obj_dir lib) in - match Lib.private_obj_dir lib with - | None -> obj_dirs - | Some private_obj_dir -> Path.Set.add obj_dirs private_obj_dir + Path.Set.add obj_dirs (Lib.obj_dir lib) )) in let src_dirs = diff --git a/test/blackbox-tests/test-cases/merlin-tests/run.t b/test/blackbox-tests/test-cases/merlin-tests/run.t index 3827c995f2b..88d19cea6d5 100644 --- a/test/blackbox-tests/test-cases/merlin-tests/run.t +++ b/test/blackbox-tests/test-cases/merlin-tests/run.t @@ -11,7 +11,6 @@ B $LIB_PREFIX/lib/ocaml B ../_build/default/exe/.x.eobjs B ../_build/default/lib/.foo.objs - B ../_build/default/lib/.foo.objs/.private S $LIB_PREFIX/lib/bytes S $LIB_PREFIX/lib/findlib S $LIB_PREFIX/lib/ocaml @@ -25,6 +24,7 @@ B $LIB_PREFIX/lib/ocaml B ../_build/default/lib/.bar.objs B ../_build/default/lib/.foo.objs + B ../_build/default/lib/.foo.objs/.private S $LIB_PREFIX/lib/bytes S $LIB_PREFIX/lib/findlib S $LIB_PREFIX/lib/ocaml