Commit b701558
committed
avoid generating duplicate stream and future constructors
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 the mangled name of the payload type for
deduplication. That's not 100% reliable either, since the name mangling code
does not yet guarantee every distinct type will have a unique mangled name, so
there's more work to do there, but this at least 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 b701558
1 file changed
+12
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1742 | 1742 | | |
1743 | 1743 | | |
1744 | 1744 | | |
1745 | | - | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
1746 | 1750 | | |
1747 | 1751 | | |
1748 | | - | |
| 1752 | + | |
1749 | 1753 | | |
1750 | 1754 | | |
1751 | 1755 | | |
| |||
1766 | 1770 | | |
1767 | 1771 | | |
1768 | 1772 | | |
1769 | | - | |
1770 | | - | |
1771 | | - | |
1772 | 1773 | | |
1773 | 1774 | | |
1774 | 1775 | | |
| |||
1795 | 1796 | | |
1796 | 1797 | | |
1797 | 1798 | | |
1798 | | - | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
1799 | 1804 | | |
1800 | 1805 | | |
1801 | | - | |
| 1806 | + | |
1802 | 1807 | | |
1803 | | - | |
1804 | | - | |
1805 | | - | |
1806 | 1808 | | |
1807 | 1809 | | |
1808 | 1810 | | |
| |||
0 commit comments