(
&mut self,
expected: &TypeComponentInstance,
actual: Option<&NameMap<Atom, Definition>>,
)
| 152 | } |
| 153 | |
| 154 | fn instance( |
| 155 | &mut self, |
| 156 | expected: &TypeComponentInstance, |
| 157 | actual: Option<&NameMap<Atom, Definition>>, |
| 158 | ) -> Result<()> { |
| 159 | // Like modules, every export in the expected type must be present in |
| 160 | // the actual type. It's ok, though, to have extra exports in the actual |
| 161 | // type. |
| 162 | for (name, expected) in expected.exports.iter() { |
| 163 | // Interface types may be exported from a component in order to give them a name, but |
| 164 | // they don't have a definition in the sense that this search is interested in, so |
| 165 | // ignore them. |
| 166 | if let TypeDef::Interface(_) = expected.ty { |
| 167 | continue; |
| 168 | } |
| 169 | let actual = actual.and_then(|actual| actual.get(name, self.strings)); |
| 170 | self.definition(&expected.ty, actual) |
| 171 | .with_context(|| format!("instance export `{name}` has the wrong type"))?; |
| 172 | } |
| 173 | Ok(()) |
| 174 | } |
| 175 | |
| 176 | fn func(&self, expected: TypeFuncIndex, actual: &HostFunc) -> Result<()> { |
| 177 | let instance_type = InstanceType { |
no test coverage detected