Repository navigation
Record the module after a qualified free path in the AST header - #8939
Conversation
Why:
In a namespaced package, a module that names a sibling only as
`Ns.Target` got no dependency on it: the `-bs-ast` header listed the
head `Ns` alone, and both build systems drop their own namespace, since
it does not say which module to wait for. User could then compile
before or alongside Target, failing with "Ns.Target is an alias for
module Target-Ns, which is missing", or stay stale after Target
changed. Whether it failed depended on scheduling, so `rescript-rust`
reported it on projects where `rescript` happened not to.
Diagnostic removed (clean build of a namespaced package):
Example:
// Target.res
let value = 1
// User.res
let value = Ns.Target.value + 1
Before (diagnostic):
The module Ns.Target is an alias for module Target-Ns, which is missing
After (diagnostic): (none)
Dependencies modified (AST header of User.res):
Before (text):
Ns
After (text):
Ns
Ns.Target
Depend now also records `S.M` for a free path `S.M…`. Both build systems
already resolve `Ns.M` to `M-Ns` inside namespace `Ns` and take the head of
any other dotted name, so they need no change.
Review: Does the larger header change dependencies outside the own namespace?
Only by adding precise ones: Rust takes the head of `Belt.Array`, and the
OCaml builder resolves `Dep.X` to `X-Dep` when Dep is another package's
namespace, beside the namespace map it already depends on.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Paul Tsnobiladzé <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8939 +/- ##
=======================================
Coverage 81.14% 81.14%
=======================================
Files 456 456
Lines 63760 63775 +15
=======================================
+ Hits 51738 51753 +15
Misses 12022 12022
🚀 New features to boost your workflow:
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8939 |
In a namespaced package, a module that names a sibling only as
Ns.Target(for example<Aria.Input />inside theAriapackage) got no dependency on it. The-bs-astheader listed the headNsalone, and both build systems drop their own namespace, since it doesn't say which module to wait for. SoUsercould compile before or alongsideTargetand fail with:It could also stay stale after
Targetchanged. Whether it failed depended on scheduling, which is whyrescript-rustreported it on a project whererescripthappened not to.Dependnow also recordsS.Mfor a free pathS.M…. Both build systems already resolveNs.MtoM-Nsinside namespaceNsand take the head of any other dotted name, so neither needs a change.Tests
compile/22-qualified-own-namespace-dependency.sh: a clean build of a namespaced package whereUserreachesTargetonly asNs.Target, then an incremental build that must recompileUserand report its type error. Without the fix it fails with bothrescriptandrescript-rust. With the fix it passes with both.make test-rewatchand the ounit, mocha, build and docstring tests pass.🤖 Generated with Claude Code