Skip to content

Commit 445db15

Browse files
authored
rename fixed size list to fixed-length lists (#2421)
* rename fixed size to fixed-length * found some places where the feature was missing an s * a few renames were missing * hopefully the last round of test related string changes * the correct error message lead to a reformat
1 parent 22a56f1 commit 445db15

File tree

56 files changed

+204
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+204
-197
lines changed

crates/wasm-compose/src/encoding.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,8 @@ impl<'a> TypeEncoder<'a> {
657657
ComponentDefinedType::Variant(v) => self.variant(state, v),
658658
ComponentDefinedType::List(ty) => self.list(state, *ty),
659659
ComponentDefinedType::Map(key, value) => self.map(state, *key, *value),
660-
ComponentDefinedType::FixedSizeList(ty, elements) => {
661-
self.fixed_size_list(state, *ty, *elements)
660+
ComponentDefinedType::FixedLengthList(ty, elements) => {
661+
self.fixed_length_list(state, *ty, *elements)
662662
}
663663
ComponentDefinedType::Tuple(t) => self.tuple(state, t),
664664
ComponentDefinedType::Flags(names) => Self::flags(&mut state.cur.encodable, names),
@@ -733,7 +733,7 @@ impl<'a> TypeEncoder<'a> {
733733
index
734734
}
735735

736-
fn fixed_size_list(
736+
fn fixed_length_list(
737737
&self,
738738
state: &mut TypeState<'a>,
739739
ty: ct::ComponentValType,
@@ -746,7 +746,7 @@ impl<'a> TypeEncoder<'a> {
746746
.encodable
747747
.ty()
748748
.defined_type()
749-
.fixed_size_list(ty, elements);
749+
.fixed_length_list(ty, elements);
750750
index
751751
}
752752

@@ -1271,7 +1271,7 @@ impl DependencyRegistrar<'_, '_> {
12711271
| ComponentDefinedType::Enum(_)
12721272
| ComponentDefinedType::Flags(_) => {}
12731273
ComponentDefinedType::List(t)
1274-
| ComponentDefinedType::FixedSizeList(t, _)
1274+
| ComponentDefinedType::FixedLengthList(t, _)
12751275
| ComponentDefinedType::Option(t) => self.val_type(*t),
12761276
ComponentDefinedType::Map(k, v) => {
12771277
self.val_type(*k);

crates/wasm-encoder/src/component/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,8 @@ impl ComponentDefinedTypeEncoder<'_> {
627627
value.into().encode(self.0);
628628
}
629629

630-
/// Define a fixed size list type.
631-
pub fn fixed_size_list(self, ty: impl Into<ComponentValType>, elements: u32) {
630+
/// Define a fixed-length list type.
631+
pub fn fixed_length_list(self, ty: impl Into<ComponentValType>, elements: u32) {
632632
self.0.push(0x67);
633633
ty.into().encode(self.0);
634634
elements.encode(self.0);

crates/wasm-encoder/src/reencode/component.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,8 +775,8 @@ pub mod component_utils {
775775
reencoder.component_val_type(v),
776776
);
777777
}
778-
wasmparser::ComponentDefinedType::FixedSizeList(t, elements) => {
779-
defined.fixed_size_list(reencoder.component_val_type(t), elements);
778+
wasmparser::ComponentDefinedType::FixedLengthList(t, elements) => {
779+
defined.fixed_length_list(reencoder.component_val_type(t), elements);
780780
}
781781
wasmparser::ComponentDefinedType::Tuple(t) => {
782782
defined.tuple(t.iter().map(|t| reencoder.component_val_type(*t)));

crates/wasm-wave/src/value/ty.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct Type(pub(super) TypeEnum);
1010
pub(super) enum TypeEnum {
1111
Simple(SimpleType),
1212
List(Arc<ListType>),
13-
FixedSizeList(Arc<ListType>, u32),
13+
FixedLengthList(Arc<ListType>, u32),
1414
Record(Arc<RecordType>),
1515
Tuple(Arc<TupleType>),
1616
Variant(Arc<VariantType>),
@@ -57,9 +57,9 @@ impl Type {
5757
}
5858

5959
/// Returns a list type with the given element type.
60-
pub fn fixed_size_list(element_type: impl Into<Self>, elements: u32) -> Self {
60+
pub fn fixed_length_list(element_type: impl Into<Self>, elements: u32) -> Self {
6161
let element = element_type.into();
62-
Self(TypeEnum::FixedSizeList(
62+
Self(TypeEnum::FixedLengthList(
6363
Arc::new(ListType { element }),
6464
elements,
6565
))
@@ -199,7 +199,7 @@ impl WasmType for Type {
199199
match self.0 {
200200
TypeEnum::Simple(simple) => simple.0,
201201
TypeEnum::List(_) => WasmTypeKind::List,
202-
TypeEnum::FixedSizeList(_, _) => WasmTypeKind::FixedSizeList,
202+
TypeEnum::FixedLengthList(_, _) => WasmTypeKind::FixedLengthList,
203203
TypeEnum::Record(_) => WasmTypeKind::Record,
204204
TypeEnum::Tuple(_) => WasmTypeKind::Tuple,
205205
TypeEnum::Variant(_) => WasmTypeKind::Variant,

crates/wasm-wave/src/value/wit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ impl<'a> TypeResolver<'a> {
7171
TypeDefKind::Option(some_type) => self.resolve_option(some_type),
7272
TypeDefKind::Result(result) => self.resolve_result(result),
7373
TypeDefKind::List(element_type) => self.resolve_list(element_type),
74-
TypeDefKind::FixedSizeList(element_type, elements) => {
75-
self.resolve_fixed_size_list(element_type, *elements)
74+
TypeDefKind::FixedLengthList(element_type, elements) => {
75+
self.resolve_fixed_length_list(element_type, *elements)
7676
}
7777
TypeDefKind::Type(Type::Bool) => Ok(value::Type::BOOL),
7878
TypeDefKind::Type(Type::U8) => Ok(value::Type::U8),
@@ -150,9 +150,9 @@ impl<'a> TypeResolver<'a> {
150150
Ok(value::Type::list(element_type))
151151
}
152152

153-
fn resolve_fixed_size_list(&self, element_type: &Type, elements: u32) -> ValueResult {
153+
fn resolve_fixed_length_list(&self, element_type: &Type, elements: u32) -> ValueResult {
154154
let element_type = self.resolve_type(*element_type)?;
155-
Ok(value::Type::fixed_size_list(element_type, elements))
155+
Ok(value::Type::fixed_length_list(element_type, elements))
156156
}
157157
}
158158

crates/wasm-wave/src/wasm/ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub enum WasmTypeKind {
2020
Char,
2121
String,
2222
List,
23-
FixedSizeList,
23+
FixedLengthList,
2424
Record,
2525
Tuple,
2626
Variant,
@@ -49,7 +49,7 @@ impl core::fmt::Display for WasmTypeKind {
4949
WasmTypeKind::Char => "char",
5050
WasmTypeKind::String => "string",
5151
WasmTypeKind::List => "list",
52-
WasmTypeKind::FixedSizeList => "list<_,N>",
52+
WasmTypeKind::FixedLengthList => "list<_,N>",
5353
WasmTypeKind::Record => "record",
5454
WasmTypeKind::Tuple => "tuple",
5555
WasmTypeKind::Variant => "variant",

crates/wasm-wave/src/writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<W: Write> Writer<W> {
7575
}
7676
self.write_str("]")
7777
}
78-
WasmTypeKind::FixedSizeList => {
78+
WasmTypeKind::FixedLengthList => {
7979
self.write_str("[")?;
8080
for (idx, val) in val.unwrap_list().enumerate() {
8181
if idx != 0 {

crates/wasmparser/src/features.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,11 @@ define_wasm_features! {
276276
/// Corresponds to the 📝 character in
277277
/// <https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md>.
278278
pub cm_error_context: CM_ERROR_CONTEXT(1 << 31) = false;
279-
/// Support for fixed size lists
279+
/// Support for fixed-length lists
280280
///
281281
/// Corresponds to the 🔧 character in
282282
/// <https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md>.
283-
pub cm_fixed_size_list: CM_FIXED_SIZE_LIST(1 << 32) = false;
283+
pub cm_fixed_length_lists: CM_FIXED_LENGTH_LISTS(1 << 32) = false;
284284
/// Support for Wasm GC in the component model proposal.
285285
///
286286
/// Corresponds to the 🛸 character in

crates/wasmparser/src/readers/component/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ pub enum ComponentDefinedType<'a> {
448448
List(ComponentValType),
449449
/// The type is a map of the given key and value types.
450450
Map(ComponentValType, ComponentValType),
451-
/// The type is a fixed size list of the given value type.
452-
FixedSizeList(ComponentValType, u32),
451+
/// The type is a fixed-length list of the given value type.
452+
FixedLengthList(ComponentValType, u32),
453453
/// The type is a tuple of the given value types.
454454
Tuple(Box<[ComponentValType]>),
455455
/// The type is flags with the given names.
@@ -513,7 +513,7 @@ impl<'a> ComponentDefinedType<'a> {
513513
},
514514
0x69 => ComponentDefinedType::Own(reader.read()?),
515515
0x68 => ComponentDefinedType::Borrow(reader.read()?),
516-
0x67 => ComponentDefinedType::FixedSizeList(reader.read()?, reader.read_var_u32()?),
516+
0x67 => ComponentDefinedType::FixedLengthList(reader.read()?, reader.read_var_u32()?),
517517
0x66 => ComponentDefinedType::Stream(reader.read()?),
518518
0x65 => ComponentDefinedType::Future(reader.read()?),
519519
x => return reader.invalid_leading_byte(x, "component defined type"),

crates/wasmparser/src/validator/component.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ impl ComponentState {
949949
.unwrap_or(true)
950950
}
951951
ComponentDefinedType::List(ty)
952-
| ComponentDefinedType::FixedSizeList(ty, _)
952+
| ComponentDefinedType::FixedLengthList(ty, _)
953953
| ComponentDefinedType::Option(ty) => types.type_named_valtype(ty, set),
954954
ComponentDefinedType::Map(k, v) => {
955955
types.type_named_valtype(k, set) && types.type_named_valtype(v, set)
@@ -3929,17 +3929,20 @@ impl ComponentState {
39293929
self.create_component_val_type(value, offset)?,
39303930
))
39313931
}
3932-
crate::ComponentDefinedType::FixedSizeList(ty, elements) => {
3933-
if !self.features.cm_fixed_size_list() {
3932+
crate::ComponentDefinedType::FixedLengthList(ty, elements) => {
3933+
if !self.features.cm_fixed_length_lists() {
39343934
bail!(
39353935
offset,
3936-
"Fixed size lists require the component model fixed size list feature"
3936+
"Fixed-length lists require the component model fixed-length lists feature"
39373937
)
39383938
}
39393939
if elements < 1 {
3940-
bail!(offset, "Fixed size lists must have more than zero elements")
3940+
bail!(
3941+
offset,
3942+
"Fixed-length lists must have more than zero elements"
3943+
)
39413944
}
3942-
Ok(ComponentDefinedType::FixedSizeList(
3945+
Ok(ComponentDefinedType::FixedLengthList(
39433946
self.create_component_val_type(ty, offset)?,
39443947
elements,
39453948
))

0 commit comments

Comments
 (0)