-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(melange): use output of virtual library when compiling its source (…
…#11248) * test(melange): show crash when depending on public virtual lib impl Signed-off-by: Antonio Nuno Monteiro <[email protected]> * fix(melange): use output of virtual library when compiling its source modules Signed-off-by: Antonio Nuno Monteiro <[email protected]> * chore: add changelog entry Signed-off-by: Antonio Nuno Monteiro <[email protected]> --------- Signed-off-by: Antonio Nuno Monteiro <[email protected]>
- Loading branch information
1 parent
4757aa6
commit f0137df
Showing
3 changed files
with
54 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- Fix a crash in the Melange rules that would prevent compiling public library | ||
implementations of virtual libraries. (@amonteiro, #11248) | ||
|
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
50 changes: 50 additions & 0 deletions
50
test/blackbox-tests/test-cases/melange/virtual-lib-public-impl.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,50 @@ | ||
Test virtual libraries where the virtual implementation is a public library | ||
|
||
$ mkdir -p vlib js_impl test | ||
$ cat > dune-project <<EOF | ||
> (lang dune 3.13) | ||
> (using melange 0.1) | ||
> (package (name the_lib)) | ||
> (package (name concrete_lib)) | ||
> EOF | ||
$ cat > vlib/dune <<EOF | ||
> (library | ||
> (name the_lib) | ||
> (modes melange native) | ||
> (public_name the_lib) | ||
> (virtual_modules virt)) | ||
> EOF | ||
$ cat > vlib/the_lib.mli <<EOF | ||
> module Time : sig | ||
> val gettimeofday : unit -> float | ||
> end | ||
> EOF | ||
$ cat > vlib/the_lib.ml <<EOF | ||
> module Time = struct | ||
> let gettimeofday () = Virt.gettimeofday () | ||
> end | ||
> EOF | ||
$ cat > vlib/virt.mli <<EOF | ||
> val gettimeofday : unit -> float | ||
> EOF | ||
|
||
$ cat > js_impl/dune <<EOF | ||
> (library | ||
> (name timeJs) | ||
> (public_name concrete_lib) | ||
> (implements the_lib) | ||
> (modes melange) | ||
> (preprocess (pps melange.ppx))) | ||
> EOF | ||
$ cat > js_impl/virt.ml <<EOF | ||
> let gettimeofday : unit -> float = fun () -> 42. | ||
> EOF | ||
|
||
$ cat > test/dune <<EOF | ||
> (melange.emit | ||
> (target output) | ||
> (libraries the_lib concrete_lib) | ||
> (emit_stdlib false)) | ||
> EOF | ||
|
||
$ dune build @melange |