Skip to content

Commit 2e01b5c

Browse files
committed
Fix FixedSizeList type silently losing size and Map todo panic
FixedSizeList was being converted to a regular List, discarding the size parameter. Now correctly maps to DefinedType::FixedSizeList preserving both the element type and size. Also replaced the todo!() panic for ComponentDefinedType::Map with a proper error, since encountering Map types at runtime should not crash.
1 parent e1e684a commit 2e01b5c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/wac-types/src/package.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,12 +754,12 @@ impl<'a> TypeConverter<'a> {
754754
let option = ty.map(|ty| self.component_val_type(ty)).transpose()?;
755755
ValueType::Defined(self.types.add_defined_type(DefinedType::Future(option)))
756756
}
757-
wasm::ComponentDefinedType::FixedSizeList(ty, _) => {
757+
wasm::ComponentDefinedType::FixedSizeList(ty, size) => {
758758
let ty = self.component_val_type(*ty)?;
759-
ValueType::Defined(self.types.add_defined_type(DefinedType::List(ty)))
759+
ValueType::Defined(self.types.add_defined_type(DefinedType::FixedSizeList(ty, *size)))
760760
}
761761
wasmparser::component_types::ComponentDefinedType::Map(_, _) => {
762-
todo!("wasmparser::component_types::ComponentDefinedType::Map");
762+
bail!("ComponentDefinedType::Map is not yet supported");
763763
}
764764
};
765765

0 commit comments

Comments
 (0)