Add implements clause support to wac#200
Merged
Merged
Conversation
f2893ca to
e0a96b3
Compare
Support the component model's implements name form, which allows importing/exporting the same interface multiple times under different plain-name labels (e.g., primary/backup stores).
Collaborator
|
@ricochet thanks for driving this! Ack'ing your review request -- i'll start digging into this over the next few days / week. |
fibonacci1729
approved these changes
Jun 29, 2026
fibonacci1729
left a comment
Collaborator
There was a problem hiding this comment.
This looks great!
I think it would be great to add a test that explicitly exercises the spec's more subtle transitive use case where two labeled imports of an interface should share a separately imported types interface resource instead of duplicating it. I don't believe the code mishandles that case, but it is the main scenario I'd like to see covered because the spec discussion calls it out as important.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds support for composing components that use the component model (implements "I") clause (component-model#613), which lets a component import or export the same interface more than once under different plain-names.
In the binary this encodes each extern with a plain-name label and an (implements "…") directive carrying the interface it implements:
This change makes it so that each labeled extern is preserved as its own instance and round-trips the implements directive.
Bump to latest wasm-tools which has implements support. Part of this was also adding ComponentItem to
TypeConverter::entity, and for an instance extern, resolves the interface id from the implements metadata when present.