wasm-tools icon indicating copy to clipboard operation
wasm-tools copied to clipboard

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

Open alexcrichton opened this issue 3 years ago • 0 comments

This component

(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 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.

alexcrichton avatar Jul 05 '22 17:07 alexcrichton