Skip to content

fix: name collisions and empty namespaces#1331

Draft
jsturtevant wants to merge 4 commits intohyperlight-dev:mainfrom
jsturtevant:component-util-fixes
Draft

fix: name collisions and empty namespaces#1331
jsturtevant wants to merge 4 commits intohyperlight-dev:mainfrom
jsturtevant:component-util-fixes

Conversation

@jsturtevant
Copy link
Contributor

Add collision.wasm to the witguest-wit Justfile recipe so it is built from the collision-test/ WIT directory alongside interface.wasm and twoworlds.wasm. Upload and download it as a CI artifact so the collision integration tests can run in the test workflow.

fixes: #1329
fixes: #1328

Signed-off-by: James Sturtevant jsturtevant@gmail.com

When a WIT interface has no namespace path (e.g. no package prefix),
the generated Rust code would produce invalid double-colon (::) paths.
Add guards to emit correct paths when the namespace is empty.

Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
When multiple WIT packages exports an interface with the same name
(e.g. a:pkg/types and b:pkg/types), the generated Rust trait would
have duplicate associated types and getters, causing compilation to
hang or fail.

Add collision detection that scans import declarations for duplicate
interface names. When a collision is found, the full namespace path is
prepended to produce unique names (e.g. APkgTypes vs BPkgTypes).

Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
Apply the same import_member_names() collision detection to guest.rs
that was already applied to host.rs and rtypes.rs. Without this,
guest_bindgen! would generate duplicate type aliases and getter
functions when two packages export interfaces with the same name.

Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
Add collision.wasm to the witguest-wit Justfile recipe so it is built
from the collision-test/ WIT directory alongside interface.wasm and
twoworlds.wasm. Upload and download it as a CI artifact so the
collision integration tests can run in the test workflow.

Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
@jsturtevant jsturtevant changed the title Component util fixes fix: name collisions and empty namespaces Mar 20, 2026
@jsturtevant jsturtevant added the kind/bugfix For PRs that fix bugs label Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bugfix For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wit: empty namespaces wit: name collision + noff_var_id

1 participant