Ignore when components export type definitions (#5051)

* allow a ComponentTypeRef::Type to point to a component TypeDef

* component matching: don't assert exported Interface type definitions are "defined"

types may be exported by their name for consumption by some component
runtimes, but in wasmtime this doesn't matter (we lift and lower to
types, not define them) so we should ignore these.

* component-model instance tests: show that an import can export a type definition

this is meaningless, but it should be accepted. (previously rejected)
This commit is contained in:
Pat Hickey
2022-10-12 15:45:03 -07:00
committed by GitHub
parent 4639e85c4e
commit f96491f333
3 changed files with 13 additions and 3 deletions

View File

@@ -469,6 +469,7 @@ impl ComponentTypesBuilder {
self.core_outer_type(0, TypeIndex::from_u32(*ty))
}
wasmparser::ComponentTypeRef::Func(ty)
| wasmparser::ComponentTypeRef::Type(_, ty)
| wasmparser::ComponentTypeRef::Instance(ty)
| wasmparser::ComponentTypeRef::Component(ty) => {
self.component_outer_type(0, ComponentTypeIndex::from_u32(*ty))
@@ -476,9 +477,6 @@ impl ComponentTypesBuilder {
wasmparser::ComponentTypeRef::Value(..) => {
unimplemented!("references to value types");
}
wasmparser::ComponentTypeRef::Type(..) => {
unimplemented!("references to types");
}
}
}