Skip to content

Commit

Permalink
Reproduce ocaml#2896
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Mar 4, 2020
1 parent 1a9a2b7 commit 2fb4995
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/blackbox-tests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,14 @@
test-cases/virtual-libraries/dune-package-info
(progn (run dune-cram run run.t) (diff? run.t run.t.corrected)))))

(rule
(alias virtual-libraries-github2896)
(deps (package dune) (source_tree test-cases/virtual-libraries/github2896))
(action
(chdir
test-cases/virtual-libraries/github2896
(progn (run dune-cram run run.t) (diff? run.t run.t.corrected)))))

(rule
(alias virtual-libraries-impl-lib-interface-module)
(deps
Expand Down Expand Up @@ -2622,6 +2630,7 @@
(alias vendor-do-not-install-vendored-packages)
(alias virtual-libraries-double-implementation)
(alias virtual-libraries-dune-package-info)
(alias virtual-libraries-github2896)
(alias virtual-libraries-impl-lib-interface-module)
(alias virtual-libraries-impl-not-virtual)
(alias virtual-libraries-impl-not-virtual-external)
Expand Down Expand Up @@ -2873,6 +2882,7 @@
(alias vendor-do-not-install-vendored-packages)
(alias virtual-libraries-double-implementation)
(alias virtual-libraries-dune-package-info)
(alias virtual-libraries-github2896)
(alias virtual-libraries-impl-lib-interface-module)
(alias virtual-libraries-impl-not-virtual)
(alias virtual-libraries-impl-not-virtual-external)
Expand Down
31 changes: 31 additions & 0 deletions test/blackbox-tests/test-cases/virtual-libraries/github2896/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Reproduction of the issue in #2896

We have a dependency cycle of the form impl <- lib <- vlib

where vlib is a virtual library, and impl implements this library.

$ echo "(lang dune 2.3)" > dune-project
$ mkdir vlib impl lib
$ touch impl/vlib.ml
$ echo "val run : unit -> unit" > vlib/vlib.mli
$ cat >vlib/dune <<EOF
> (library (name vlib) (virtual_modules vlib))
> EOF
$ echo "let bar () = Vlib.run ();;" > lib/lib.ml
$ cat >lib/dune <<EOF
> (library (name lib) (libraries vlib))
> EOF
$ echo "let run () = Lib.bar ();;" > impl/vlib.ml
$ cat >impl/dune <<EOF
> (library (name impl) (implements vlib) (libraries lib))
> EOF

The implementation impl was built, but it's not usable:

$ echo 'Vlib.run ()' > foo.ml
$ echo "(executable (name foo) (libraries impl))" > dune
$ dune exec ./foo.exe
File "_none_", line 1:
Error: No implementations provided for the following modules:
Vlib referenced from lib/lib.cmxa(Lib)
[1]

0 comments on commit 2fb4995

Please sign in to comment.