diff --git a/crates/environ/src/component/types.rs b/crates/environ/src/component/types.rs index b6666308d4..4c715b61ef 100644 --- a/crates/environ/src/component/types.rs +++ b/crates/environ/src/component/types.rs @@ -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"); - } } } diff --git a/crates/wasmtime/src/component/matching.rs b/crates/wasmtime/src/component/matching.rs index e5012a5043..ae38e3301a 100644 --- a/crates/wasmtime/src/component/matching.rs +++ b/crates/wasmtime/src/component/matching.rs @@ -72,6 +72,12 @@ impl TypeChecker<'_> { // the actual type. It's ok, though, to have extra exports in the actual // type. for (name, expected) in expected.exports.iter() { + // Interface types may be exported from a component in order to give them a name, but + // they don't have a definition in the sense that this search is interested in, so + // ignore them. + if let TypeDef::Interface(_) = expected { + continue; + } let actual = self .strings .lookup(name) diff --git a/tests/misc_testsuite/component-model/instance.wast b/tests/misc_testsuite/component-model/instance.wast index 74e5270122..d23fe605fa 100644 --- a/tests/misc_testsuite/component-model/instance.wast +++ b/tests/misc_testsuite/component-model/instance.wast @@ -179,6 +179,12 @@ )) ) +(component + (import "host" (instance $i + (type $rec (record (field "x" (record)) (field "y" string))) + (export "some-record" (type (eq $rec))))) +) + (component (import "host" (instance $i (export "nested" (instance