Skip to content

Commit 15c2bb1

Browse files
committed
Adds private directory in the right case
- a library sees its private directory - a library doesn't see other private directory Signed-off-by: François Bobot <[email protected]>
1 parent 57fa72c commit 15c2bb1

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
unreleased
22
----------
33

4+
- Fix merlin handling of private module visibility (#1653 @bobot)
5+
46
- unstable-fmt: use boxes to wrap some lists (#1608, fix #1153, @emillon,
57
thanks to @rgrinberg)
68

src/lib_rules.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,13 +538,19 @@ module Gen (P : Install_rules.Params) = struct
538538
; compile_info
539539
};
540540

541+
let objs_dirs = Path.Set.singleton obj_dir in
542+
let objs_dirs = if Lib_modules.has_private_modules lib_modules then
543+
Path.Set.add objs_dirs private_obj_dir
544+
else objs_dirs in
545+
541546
(cctx,
542547
Merlin.make ()
543548
~requires:(Lib.Compile.requires compile_info)
544549
~flags
545550
~preprocess:(Buildable.single_preprocess lib.buildable)
546551
~libname:(snd lib.name)
547-
~objs_dirs:(Path.Set.singleton obj_dir))
552+
~objs_dirs
553+
)
548554

549555
let rules (lib : Library.t) ~dir_contents ~dir ~expander ~scope
550556
~dir_kind : Compilation_context.t * Merlin.t =

src/merlin.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ let dot_merlin sctx ~dir ~more_src_dirs ~scope ~dir_kind
144144
Lib.src_dir lib
145145
|> Path.drop_optional_build_context)
146146
,
147-
let obj_dirs = Path.Set.add obj_dirs (Lib.obj_dir lib) in
148-
match Lib.private_obj_dir lib with
149-
| None -> obj_dirs
150-
| Some private_obj_dir -> Path.Set.add obj_dirs private_obj_dir
147+
Path.Set.add obj_dirs (Lib.obj_dir lib)
151148
))
152149
in
153150
let src_dirs =

test/blackbox-tests/test-cases/merlin-tests/run.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
B $LIB_PREFIX/lib/ocaml
1212
B ../_build/default/exe/.x.eobjs
1313
B ../_build/default/lib/.foo.objs
14-
B ../_build/default/lib/.foo.objs/.private
1514
S $LIB_PREFIX/lib/bytes
1615
S $LIB_PREFIX/lib/findlib
1716
S $LIB_PREFIX/lib/ocaml
@@ -25,6 +24,7 @@
2524
B $LIB_PREFIX/lib/ocaml
2625
B ../_build/default/lib/.bar.objs
2726
B ../_build/default/lib/.foo.objs
27+
B ../_build/default/lib/.foo.objs/.private
2828
S $LIB_PREFIX/lib/bytes
2929
S $LIB_PREFIX/lib/findlib
3030
S $LIB_PREFIX/lib/ocaml

0 commit comments

Comments
 (0)