Commit 89af297
authored
avoid generating duplicate stream and future constructors (#206)
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 #205 will
cover it once it's merged.1 parent df7c6cc commit 89af297
5 files changed
+158
-46
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
| 375 | + | |
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| |||
803 | 803 | | |
804 | 804 | | |
805 | 805 | | |
806 | | - | |
| 806 | + | |
807 | 807 | | |
808 | 808 | | |
809 | 809 | | |
| |||
0 commit comments