-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(melange): depend on selected impl when setting up JS rules for virtual lib #10051
Merged
anmonteiro
merged 3 commits into
ocaml:main
from
anmonteiro:anmonteiro/fix-melange-virtual-libs
Feb 17, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 @@ | ||
- melange: fix inconsistency in virtual library implementation. Concrete | ||
modules within a virtual library can now refer to its virtual modules too | ||
(#10051, fixes #7104, @anmonteiro) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
(target output) | ||
(alias mel) | ||
(modules mel) | ||
(emit_stdlib false) | ||
(libraries vlib impl_melange)) |
2 changes: 1 addition & 1 deletion
2
test/blackbox-tests/test-cases/melange/virtual_lib_compilation.t/mel.ml
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 |
---|---|---|
@@ -1 +1 @@ | ||
print_endline Virt.t | ||
let () = print_endline Vlib_impl.hello |
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 |
---|---|---|
|
@@ -19,18 +19,25 @@ The native build passes | |
ocamlopt ml.exe | ||
Hello from ml | ||
|
||
Melange can't produce a `.cmj` solely from a virtual module `.cmi`, because it | ||
needs to consult the `.cmj` files of dependencies to know where the require | ||
call should be emitted | ||
Any module requiring a virtual module (including modules within the virtual | ||
library itself) needs to consult the `.cmj` file for the concrete | ||
implementation being seleced to know where to `import` from in the generated | ||
JS. The following build works because Dune tracks concrete implementation | ||
`.cmj` files as dependencies of the JS rules. | ||
|
||
$ dune build @mel --display=short 2>&1 | grep -v 'node_modules/melange' | ||
melc vlib/.vlib.objs/melange/virt.{cmi,cmti} | ||
ocamldep impl_melange/.impl_melange.objs/virt.impl.d | ||
melc vlib/.vlib.objs/melange/vlib_impl.{cmi,cmj,cmt} (exit 2) | ||
File "vlib/vlib_impl.ml", line 1: | ||
Error: Virt not found, it means either the module does not exist or it is a namespace | ||
melc vlib/.vlib.objs/melange/vlib_impl.{cmi,cmj,cmt} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the description in line 22 needs to be updated. |
||
melc vlib/.vlib.objs/melange/shared.{cmi,cmj,cmt} | ||
melc impl_melange/.impl_melange.objs/melange/virt.{cmj,cmt} | ||
melc .output.mobjs/melange/melange__Mel.{cmi,cmj,cmt} | ||
melc output/impl_melange/virt.js | ||
melc output/vlib/shared.js | ||
melc output/vlib/vlib_impl.js | ||
melc output/mel.js | ||
|
||
$ output=_build/default/output/mel.js | ||
$ test -f "$output" && node "$output" | ||
[1] | ||
Hello from melange | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the callout here is:
.cm{i,j,t}
) of the selected (concrete) implementationThis is analogous to adding the correct
.cmx
to the link path in native compilation.