avoid generating duplicate stream and future constructors#206
Merged
dicej merged 1 commit intobytecodealliance:mainfrom Feb 24, 2026
Merged
Conversation
Collaborator
Author
|
Actually, I just realized |
Previously, we used the payload type to avoid generating duplicates, but that
doesn't work reliably because `wit-parser` does not necessarily deduplicate
types involving aliases, such as the following example:
```
interface types {
variant foo {
bar,
baz
}
}
interface use-types-a {
use types.{foo};
test: func() -> future<result<foo>>;
}
interface use-types-b {
use types.{foo};
test: func() -> future<result<foo>>;
}
```
When targetting a world which imports and/or exports both `use-types-a` and
`use-types-b`, we'll end up with distinct type IDs for `result<foo>`.
This commit switches to using `wit-bindgen-core` to determine the "canonical"
type of the payload and then use that as the deduplication key. This unblocks
using `wasi:cli@0.3.0-rc-2026-02-09`, which has a similar pattern to the above
WIT example.
Note that this is awkward to test given our current test infra, but bytecodealliance#205 will
cover it once it's merged.
b701558 to
79f3ce3
Compare
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.
Previously, we used the payload type to avoid generating duplicates, but that doesn't work reliably because
wit-parserdoes not necessarily deduplicate types involving aliases, such as the following example:When targetting a world which imports and/or exports both
use-types-aanduse-types-b, we'll end up with distinct type IDs forresult<foo>.This commit switches to using
wit-bindgen-coreto determine the "canonical" type of the payload and then use that as the deduplication key. This unblocks usingwasi:cli@0.3.0-rc-2026-02-09, which has a similar pattern to the above WIT example.Note that this is awkward to test given our current test infra, but #205 will cover it once it's merged.