Skip to content

Commit

Permalink
Merge pull request #1653 from bobot/merlin_and_private_lib_dir
Browse files Browse the repository at this point in the history
Fix merlin handling of private module
  • Loading branch information
bobot authored Dec 13, 2018
2 parents 57fa72c + 15c2bb1 commit 19f7e44
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
8 changes: 7 additions & 1 deletion src/lib_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
5 changes: 1 addition & 4 deletions src/merlin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/merlin-tests/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 19f7e44

Please sign in to comment.