bytecodealliance / bytecodealliance/wasm-tools

components: Injection of outer aliases doesn't work for core wasm types

Open
#667 0 comments 0 reactions 0 assignees View on GitHub
component-model wast
Dominant language
Rust
Stars
1.8k
Forks
351
Avg merge
16h 57m
Merged PRs (30d)
38

Description

This component

```wasm
(component
(core type $t (func))
(core type (module
(export "" (func (type $t)))
))
)
```

currently yields:

```
$ wasm-tools validate foo.wat --features component-model
Error: failed to find type named `$t`
--> foo.wat:4:28
|
4 | (export "" (func (type $t)))
| ^
```

but I think we should implement automatic injection of aliases.

I initially tried to get this working by modifying [these lines](https://github.com/bytecodealliance/wasm-tools/blob/070859ee09b5e2d82129baf813c6356db5dda169/crates/wast/src/component/resolve.rs#L736-L741) to call `resolver.resolve_ns` which handles outer alias injection but that quickly ran afoul of https://github.com/WebAssembly/component-model/issues/64 where within a module type core outer aliases must be encoded one way but currently they're encoded a different way in `wast`. I didn't want to deal with all the specifics just yet so I decided to file an issue for this to not forget about it instead of finishing the implementation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.