Skip to content

Commit

Permalink
Add a test showing that S dirs of implicit deps are not sent to Merlin
Browse files Browse the repository at this point in the history
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
  • Loading branch information
voodoos committed May 15, 2024
1 parent cd9595a commit bba5be3
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executable
(name main)
(libraries lib1))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type t = Lib1.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(lang dune 2.0)
(implicit_transitive_deps false)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
$ stdlib="$(ocamlc -where)"
$ export BUILD_PATH_PREFIX_MAP="/STDLIB=$stdlib:$BUILD_PATH_PREFIX_MAP"

$ dune build @check

FIXME: 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

$ 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)

$ 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?:$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)

$ 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)
?:S?:$TESTCASE_ROOT/src/lib2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(library
(name lib1)
(libraries lib2))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Lib2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(library
(name lib2))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type t = bool

type r = float

0 comments on commit bba5be3

Please sign in to comment.