-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3235 from rgrinberg/2896-take-2
Reproduce #2896
- Loading branch information
Showing
175 changed files
with
597 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
test/blackbox-tests/test-cases/virtual-libraries/double-implementation/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Executable that tries to use two implementations for the same virtual lib | ||
$ dune build | ||
Error: Conflicting implementations for virtual library "vlib" in | ||
_build/default/vlib: | ||
- "impl1" in _build/default/impl1 | ||
-> required by library "bar" in _build/default | ||
- "impl2" in _build/default/impl2 | ||
This cannot work. | ||
-> required by executable foo in dune:2 | ||
[1] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
53 changes: 53 additions & 0 deletions
53
test/blackbox-tests/test-cases/virtual-libraries/dune-package-info/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Include variants and implementation information in dune-package | ||
$ dune build | sed "s/(lang dune .*)/(lang dune <version>)/" | ||
(lang dune <version>) | ||
(name foo) | ||
(library | ||
(name foo.impl) | ||
(kind normal) | ||
(archives (byte impl/impl.cma) (native impl/impl.cmxa)) | ||
(plugins (byte impl/impl.cma) (native impl/impl.cmxs)) | ||
(native_archives impl/impl$ext_lib) | ||
(requires foo.vlib) | ||
(implements foo.vlib) | ||
(main_module_name Vlib) | ||
(modes byte native) | ||
(modules | ||
(wrapped | ||
(main_module_name Vlib) | ||
(modules | ||
((name Vmod) | ||
(obj_name vlib__Vmod) | ||
(visibility public) | ||
(kind impl_vmodule) | ||
(impl))) | ||
(alias_module | ||
(name Vlib__impl__) | ||
(obj_name vlib__impl__) | ||
(visibility public) | ||
(kind alias) | ||
(impl)) | ||
(wrapped true)))) | ||
(library | ||
(name foo.vlib) | ||
(kind normal) | ||
(virtual) | ||
(native_archives vlib/vlib$ext_lib) | ||
(main_module_name Vlib) | ||
(modes byte native) | ||
(modules | ||
(wrapped | ||
(main_module_name Vlib) | ||
(modules | ||
((name Vmod) | ||
(obj_name vlib__Vmod) | ||
(visibility public) | ||
(kind virtual) | ||
(intf))) | ||
(alias_module | ||
(name Vlib) | ||
(obj_name vlib) | ||
(visibility public) | ||
(kind alias) | ||
(impl)) | ||
(wrapped true)))) |
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
test/blackbox-tests/test-cases/virtual-libraries/github2896/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
test/blackbox-tests/test-cases/virtual-libraries/impl-lib-interface-module/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Implementations may not provide a library interface module unless it is virtual. | ||
There should be an error message that clarifies this. | ||
|
||
$ dune build | ||
File "impl/dune", line 1, characters 0-41: | ||
1 | (library | ||
2 | (name impl) | ||
3 | (implements vlib)) | ||
Error: Implementations of wrapped libraries cannot introduce new public | ||
modules. | ||
The following modules: | ||
- Vlib | ||
must all be marked as private using the (private_modules ..) field. | ||
[1] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
test/blackbox-tests/test-cases/virtual-libraries/impl-not-virtual-external/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Test that trying to implement external libraries that aren't virtual results in | ||
an appropriate error message. | ||
$ dune build | ||
File "dune", line 7, characters 13-30: | ||
7 | (implements dune.configurator)) | ||
^^^^^^^^^^^^^^^^^ | ||
Error: Library "dune-configurator" is not virtual. It cannot be implemented | ||
by "foobar". | ||
[1] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions
8
test/blackbox-tests/test-cases/virtual-libraries/impl-not-virtual/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Test that trying to implement libraries that aren't virtual results in an | ||
appropriate error message. | ||
$ dune build | ||
File "impl/dune", line 3, characters 13-16: | ||
3 | (implements lib)) | ||
^^^ | ||
Error: Library "lib" is not virtual. It cannot be implemented by "impl". | ||
[1] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.