tint: Update constructor / conversion terminology
Rename:
* "type initializer" -> "value constructor"
* "type conversion" -> "value conversion"
Fixed: tint:1848
Change-Id: I3e86a4e944971cea970f0d137641517c36cb807d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121060
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn
index 227893c..abedec5 100644
--- a/src/tint/BUILD.gn
+++ b/src/tint/BUILD.gn
@@ -249,10 +249,10 @@
"program_builder.cc",
"resolver/const_eval.cc",
"resolver/const_eval.h",
+ "resolver/ctor_conv_intrinsic.cc",
+ "resolver/ctor_conv_intrinsic.h",
"resolver/dependency_graph.cc",
"resolver/dependency_graph.h",
- "resolver/init_conv_intrinsic.cc",
- "resolver/init_conv_intrinsic.h",
"resolver/intrinsic_table.cc",
"resolver/intrinsic_table.h",
"resolver/intrinsic_table.inl",
@@ -671,13 +671,13 @@
"sem/struct.h",
"sem/switch_statement.cc",
"sem/switch_statement.h",
- "sem/type_conversion.cc",
- "sem/type_conversion.h",
"sem/type_expression.cc",
"sem/type_expression.h",
- "sem/type_initializer.cc",
- "sem/type_initializer.h",
"sem/type_mappings.h",
+ "sem/value_constructor.cc",
+ "sem/value_constructor.h",
+ "sem/value_conversion.cc",
+ "sem/value_conversion.h",
"sem/value_expression.cc",
"sem/value_expression.h",
"sem/variable.cc",
@@ -1400,12 +1400,12 @@
"resolver/struct_address_space_use_test.cc",
"resolver/struct_layout_test.cc",
"resolver/struct_pipeline_stage_use_test.cc",
- "resolver/type_initializer_validation_test.cc",
"resolver/type_validation_test.cc",
"resolver/uniformity_test.cc",
"resolver/unresolved_identifier_test.cc",
"resolver/validation_test.cc",
"resolver/validator_is_storeable_test.cc",
+ "resolver/value_constructor_validation_test.cc",
"resolver/variable_test.cc",
"resolver/variable_validation_test.cc",
]
@@ -1639,6 +1639,7 @@
"writer/spirv/builder_builtin_texture_test.cc",
"writer/spirv/builder_call_test.cc",
"writer/spirv/builder_const_assert_test.cc",
+ "writer/spirv/builder_constructor_expression_test.cc",
"writer/spirv/builder_discard_test.cc",
"writer/spirv/builder_entry_point_test.cc",
"writer/spirv/builder_format_conversion_test.cc",
@@ -1648,7 +1649,6 @@
"writer/spirv/builder_global_variable_test.cc",
"writer/spirv/builder_ident_expression_test.cc",
"writer/spirv/builder_if_test.cc",
- "writer/spirv/builder_initializer_expression_test.cc",
"writer/spirv/builder_literal_test.cc",
"writer/spirv/builder_loop_test.cc",
"writer/spirv/builder_return_test.cc",
@@ -1767,6 +1767,7 @@
"writer/wgsl/generator_impl_case_test.cc",
"writer/wgsl/generator_impl_cast_test.cc",
"writer/wgsl/generator_impl_const_assert_test.cc",
+ "writer/wgsl/generator_impl_constructor_test.cc",
"writer/wgsl/generator_impl_continue_test.cc",
"writer/wgsl/generator_impl_diagnostic_test.cc",
"writer/wgsl/generator_impl_discard_test.cc",
@@ -1775,7 +1776,6 @@
"writer/wgsl/generator_impl_global_decl_test.cc",
"writer/wgsl/generator_impl_identifier_test.cc",
"writer/wgsl/generator_impl_if_test.cc",
- "writer/wgsl/generator_impl_initializer_test.cc",
"writer/wgsl/generator_impl_literal_test.cc",
"writer/wgsl/generator_impl_loop_test.cc",
"writer/wgsl/generator_impl_member_accessor_test.cc",
@@ -1810,13 +1810,13 @@
"writer/msl/generator_impl_case_test.cc",
"writer/msl/generator_impl_cast_test.cc",
"writer/msl/generator_impl_const_assert_test.cc",
+ "writer/msl/generator_impl_constructor_test.cc",
"writer/msl/generator_impl_continue_test.cc",
"writer/msl/generator_impl_discard_test.cc",
"writer/msl/generator_impl_function_test.cc",
"writer/msl/generator_impl_identifier_test.cc",
"writer/msl/generator_impl_if_test.cc",
"writer/msl/generator_impl_import_test.cc",
- "writer/msl/generator_impl_initializer_test.cc",
"writer/msl/generator_impl_loop_test.cc",
"writer/msl/generator_impl_member_accessor_test.cc",
"writer/msl/generator_impl_module_constant_test.cc",
@@ -1850,13 +1850,13 @@
"writer/hlsl/generator_impl_case_test.cc",
"writer/hlsl/generator_impl_cast_test.cc",
"writer/hlsl/generator_impl_const_assert_test.cc",
+ "writer/hlsl/generator_impl_constructor_test.cc",
"writer/hlsl/generator_impl_continue_test.cc",
"writer/hlsl/generator_impl_discard_test.cc",
"writer/hlsl/generator_impl_function_test.cc",
"writer/hlsl/generator_impl_identifier_test.cc",
"writer/hlsl/generator_impl_if_test.cc",
"writer/hlsl/generator_impl_import_test.cc",
- "writer/hlsl/generator_impl_initializer_test.cc",
"writer/hlsl/generator_impl_loop_test.cc",
"writer/hlsl/generator_impl_member_accessor_test.cc",
"writer/hlsl/generator_impl_module_constant_test.cc",
@@ -1891,13 +1891,13 @@
"writer/glsl/generator_impl_call_test.cc",
"writer/glsl/generator_impl_case_test.cc",
"writer/glsl/generator_impl_cast_test.cc",
+ "writer/glsl/generator_impl_constructor_test.cc",
"writer/glsl/generator_impl_continue_test.cc",
"writer/glsl/generator_impl_discard_test.cc",
"writer/glsl/generator_impl_function_test.cc",
"writer/glsl/generator_impl_identifier_test.cc",
"writer/glsl/generator_impl_if_test.cc",
"writer/glsl/generator_impl_import_test.cc",
- "writer/glsl/generator_impl_initializer_test.cc",
"writer/glsl/generator_impl_loop_test.cc",
"writer/glsl/generator_impl_member_accessor_test.cc",
"writer/glsl/generator_impl_module_constant_test.cc",
diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt
index b8a803e..dfd9624 100644
--- a/src/tint/CMakeLists.txt
+++ b/src/tint/CMakeLists.txt
@@ -331,12 +331,12 @@
sem/switch_statement.h
sem/type_expression.cc
sem/type_expression.h
- sem/type_initializer.cc
- sem/type_initializer.h
- sem/type_conversion.cc
- sem/type_conversion.h
sem/type_mappings.h
sem/variable.cc
+ sem/value_constructor.cc
+ sem/value_constructor.h
+ sem/value_conversion.cc
+ sem/value_conversion.h
sem/value_expression.cc
sem/value_expression.h
sem/while_statement.cc
@@ -564,7 +564,7 @@
tint_generated(builtin/interpolation_type BENCH TEST)
tint_generated(builtin/texel_format BENCH TEST)
-tint_generated(resolver/init_conv_intrinsic)
+tint_generated(resolver/ctor_conv_intrinsic)
tint_generated(sem/builtin_type)
tint_generated(sem/parameter_usage)
@@ -926,11 +926,11 @@
resolver/struct_layout_test.cc
resolver/struct_pipeline_stage_use_test.cc
resolver/struct_address_space_use_test.cc
- resolver/type_initializer_validation_test.cc
resolver/type_validation_test.cc
resolver/unresolved_identifier_test.cc
resolver/validation_test.cc
resolver/validator_is_storeable_test.cc
+ resolver/value_constructor_validation_test.cc
resolver/variable_test.cc
resolver/variable_validation_test.cc
scope_stack_test.cc
@@ -1140,6 +1140,7 @@
writer/spirv/builder_builtin_texture_test.cc
writer/spirv/builder_call_test.cc
writer/spirv/builder_const_assert_test.cc
+ writer/spirv/builder_constructor_expression_test.cc
writer/spirv/builder_discard_test.cc
writer/spirv/builder_entry_point_test.cc
writer/spirv/builder_format_conversion_test.cc
@@ -1149,7 +1150,6 @@
writer/spirv/builder_global_variable_test.cc
writer/spirv/builder_ident_expression_test.cc
writer/spirv/builder_if_test.cc
- writer/spirv/builder_initializer_expression_test.cc
writer/spirv/builder_literal_test.cc
writer/spirv/builder_loop_test.cc
writer/spirv/builder_return_test.cc
@@ -1180,6 +1180,7 @@
writer/wgsl/generator_impl_case_test.cc
writer/wgsl/generator_impl_cast_test.cc
writer/wgsl/generator_impl_const_assert_test.cc
+ writer/wgsl/generator_impl_constructor_test.cc
writer/wgsl/generator_impl_continue_test.cc
writer/wgsl/generator_impl_diagnostic_test.cc
writer/wgsl/generator_impl_discard_test.cc
@@ -1188,7 +1189,6 @@
writer/wgsl/generator_impl_global_decl_test.cc
writer/wgsl/generator_impl_identifier_test.cc
writer/wgsl/generator_impl_if_test.cc
- writer/wgsl/generator_impl_initializer_test.cc
writer/wgsl/generator_impl_loop_test.cc
writer/wgsl/generator_impl_literal_test.cc
writer/wgsl/generator_impl_member_accessor_test.cc
@@ -1276,12 +1276,12 @@
writer/msl/generator_impl_case_test.cc
writer/msl/generator_impl_cast_test.cc
writer/msl/generator_impl_const_assert_test.cc
+ writer/msl/generator_impl_constructor_test.cc
writer/msl/generator_impl_continue_test.cc
writer/msl/generator_impl_discard_test.cc
writer/msl/generator_impl_function_test.cc
writer/msl/generator_impl_identifier_test.cc
writer/msl/generator_impl_if_test.cc
- writer/msl/generator_impl_initializer_test.cc
writer/msl/generator_impl_import_test.cc
writer/msl/generator_impl_loop_test.cc
writer/msl/generator_impl_member_accessor_test.cc
@@ -1310,7 +1310,7 @@
writer/glsl/generator_impl_call_test.cc
writer/glsl/generator_impl_case_test.cc
writer/glsl/generator_impl_cast_test.cc
- writer/glsl/generator_impl_initializer_test.cc
+ writer/glsl/generator_impl_constructor_test.cc
writer/glsl/generator_impl_continue_test.cc
writer/glsl/generator_impl_discard_test.cc
writer/glsl/generator_impl_function_test.cc
@@ -1348,12 +1348,12 @@
writer/hlsl/generator_impl_case_test.cc
writer/hlsl/generator_impl_cast_test.cc
writer/hlsl/generator_impl_const_assert_test.cc
+ writer/hlsl/generator_impl_constructor_test.cc
writer/hlsl/generator_impl_continue_test.cc
writer/hlsl/generator_impl_discard_test.cc
writer/hlsl/generator_impl_function_test.cc
writer/hlsl/generator_impl_identifier_test.cc
writer/hlsl/generator_impl_if_test.cc
- writer/hlsl/generator_impl_initializer_test.cc
writer/hlsl/generator_impl_import_test.cc
writer/hlsl/generator_impl_loop_test.cc
writer/hlsl/generator_impl_member_accessor_test.cc
diff --git a/src/tint/ast/call_expression.h b/src/tint/ast/call_expression.h
index b22ec11..5085818 100644
--- a/src/tint/ast/call_expression.h
+++ b/src/tint/ast/call_expression.h
@@ -27,8 +27,8 @@
/// A call expression - represents either a:
/// * sem::Function
/// * sem::Builtin
-/// * sem::TypeConstructor
-/// * sem::TypeConversion
+/// * sem::ValueConstructor
+/// * sem::ValueConversion
class CallExpression final : public Castable<CallExpression, Expression> {
public:
/// Constructor
diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def
index 1815d26..45b4b04 100644
--- a/src/tint/intrinsics.def
+++ b/src/tint/intrinsics.def
@@ -820,118 +820,118 @@
@stage("fragment", "compute") fn atomicCompareExchangeWeak<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T, T) -> __atomic_compare_exchange_result<T>
////////////////////////////////////////////////////////////////////////////////
-// Type initializers //
+// Value constructors //
////////////////////////////////////////////////////////////////////////////////
-// Zero value initializers
-@must_use @const("Zero") init i32() -> i32
-@must_use @const("Zero") init u32() -> u32
-@must_use @const("Zero") init f32() -> f32
-@must_use @const("Zero") init f16() -> f16
-@must_use @const("Zero") init bool() -> bool
-@must_use @const("Zero") init vec2<T: concrete_scalar>() -> vec2<T>
-@must_use @const("Zero") init vec3<T: concrete_scalar>() -> vec3<T>
-@must_use @const("Zero") init vec4<T: concrete_scalar>() -> vec4<T>
-@must_use @const("Zero") init mat2x2<T: f32_f16>() -> mat2x2<T>
-@must_use @const("Zero") init mat2x3<T: f32_f16>() -> mat2x3<T>
-@must_use @const("Zero") init mat2x4<T: f32_f16>() -> mat2x4<T>
-@must_use @const("Zero") init mat3x2<T: f32_f16>() -> mat3x2<T>
-@must_use @const("Zero") init mat3x3<T: f32_f16>() -> mat3x3<T>
-@must_use @const("Zero") init mat3x4<T: f32_f16>() -> mat3x4<T>
-@must_use @const("Zero") init mat4x2<T: f32_f16>() -> mat4x2<T>
-@must_use @const("Zero") init mat4x3<T: f32_f16>() -> mat4x3<T>
-@must_use @const("Zero") init mat4x4<T: f32_f16>() -> mat4x4<T>
+// Zero value constructors
+@must_use @const("Zero") ctor i32() -> i32
+@must_use @const("Zero") ctor u32() -> u32
+@must_use @const("Zero") ctor f32() -> f32
+@must_use @const("Zero") ctor f16() -> f16
+@must_use @const("Zero") ctor bool() -> bool
+@must_use @const("Zero") ctor vec2<T: concrete_scalar>() -> vec2<T>
+@must_use @const("Zero") ctor vec3<T: concrete_scalar>() -> vec3<T>
+@must_use @const("Zero") ctor vec4<T: concrete_scalar>() -> vec4<T>
+@must_use @const("Zero") ctor mat2x2<T: f32_f16>() -> mat2x2<T>
+@must_use @const("Zero") ctor mat2x3<T: f32_f16>() -> mat2x3<T>
+@must_use @const("Zero") ctor mat2x4<T: f32_f16>() -> mat2x4<T>
+@must_use @const("Zero") ctor mat3x2<T: f32_f16>() -> mat3x2<T>
+@must_use @const("Zero") ctor mat3x3<T: f32_f16>() -> mat3x3<T>
+@must_use @const("Zero") ctor mat3x4<T: f32_f16>() -> mat3x4<T>
+@must_use @const("Zero") ctor mat4x2<T: f32_f16>() -> mat4x2<T>
+@must_use @const("Zero") ctor mat4x3<T: f32_f16>() -> mat4x3<T>
+@must_use @const("Zero") ctor mat4x4<T: f32_f16>() -> mat4x4<T>
-// Identity initializers
-@must_use @const("Identity") init i32(i32) -> i32
-@must_use @const("Identity") init u32(u32) -> u32
-@must_use @const("Identity") init f32(f32) -> f32
-@must_use @const("Identity") init f16(f16) -> f16
-@must_use @const("Identity") init bool(bool) -> bool
-@must_use @const("Identity") init vec2<T: scalar>(vec2<T>) -> vec2<T>
-@must_use @const("Identity") init vec3<T: scalar>(vec3<T>) -> vec3<T>
-@must_use @const("Identity") init vec4<T: scalar>(vec4<T>) -> vec4<T>
-@must_use @const("Identity") init mat2x2<T: f32_f16>(mat2x2<T>) -> mat2x2<T>
-@must_use @const("Identity") init mat2x3<T: f32_f16>(mat2x3<T>) -> mat2x3<T>
-@must_use @const("Identity") init mat2x4<T: f32_f16>(mat2x4<T>) -> mat2x4<T>
-@must_use @const("Identity") init mat3x2<T: f32_f16>(mat3x2<T>) -> mat3x2<T>
-@must_use @const("Identity") init mat3x3<T: f32_f16>(mat3x3<T>) -> mat3x3<T>
-@must_use @const("Identity") init mat3x4<T: f32_f16>(mat3x4<T>) -> mat3x4<T>
-@must_use @const("Identity") init mat4x2<T: f32_f16>(mat4x2<T>) -> mat4x2<T>
-@must_use @const("Identity") init mat4x3<T: f32_f16>(mat4x3<T>) -> mat4x3<T>
-@must_use @const("Identity") init mat4x4<T: f32_f16>(mat4x4<T>) -> mat4x4<T>
+// Identity constructors
+@must_use @const("Identity") ctor i32(i32) -> i32
+@must_use @const("Identity") ctor u32(u32) -> u32
+@must_use @const("Identity") ctor f32(f32) -> f32
+@must_use @const("Identity") ctor f16(f16) -> f16
+@must_use @const("Identity") ctor bool(bool) -> bool
+@must_use @const("Identity") ctor vec2<T: scalar>(vec2<T>) -> vec2<T>
+@must_use @const("Identity") ctor vec3<T: scalar>(vec3<T>) -> vec3<T>
+@must_use @const("Identity") ctor vec4<T: scalar>(vec4<T>) -> vec4<T>
+@must_use @const("Identity") ctor mat2x2<T: f32_f16>(mat2x2<T>) -> mat2x2<T>
+@must_use @const("Identity") ctor mat2x3<T: f32_f16>(mat2x3<T>) -> mat2x3<T>
+@must_use @const("Identity") ctor mat2x4<T: f32_f16>(mat2x4<T>) -> mat2x4<T>
+@must_use @const("Identity") ctor mat3x2<T: f32_f16>(mat3x2<T>) -> mat3x2<T>
+@must_use @const("Identity") ctor mat3x3<T: f32_f16>(mat3x3<T>) -> mat3x3<T>
+@must_use @const("Identity") ctor mat3x4<T: f32_f16>(mat3x4<T>) -> mat3x4<T>
+@must_use @const("Identity") ctor mat4x2<T: f32_f16>(mat4x2<T>) -> mat4x2<T>
+@must_use @const("Identity") ctor mat4x3<T: f32_f16>(mat4x3<T>) -> mat4x3<T>
+@must_use @const("Identity") ctor mat4x4<T: f32_f16>(mat4x4<T>) -> mat4x4<T>
-// Vector initializers (splat)
-@must_use @const("VecSplat") init vec2<T: scalar>(T) -> vec2<T>
-@must_use @const("VecSplat") init vec3<T: scalar>(T) -> vec3<T>
-@must_use @const("VecSplat") init vec4<T: scalar>(T) -> vec4<T>
+// Vector constructors (splat)
+@must_use @const("VecSplat") ctor vec2<T: scalar>(T) -> vec2<T>
+@must_use @const("VecSplat") ctor vec3<T: scalar>(T) -> vec3<T>
+@must_use @const("VecSplat") ctor vec4<T: scalar>(T) -> vec4<T>
-// Vector initializers (scalar)
-@must_use @const("VecInitS") init vec2<T: scalar>(x: T, y: T) -> vec2<T>
-@must_use @const("VecInitS") init vec3<T: scalar>(x: T, y: T, z: T) -> vec3<T>
-@must_use @const("VecInitS") init vec4<T: scalar>(x: T, y: T, z: T, w: T) -> vec4<T>
+// Vector constructors (scalar)
+@must_use @const("VecInitS") ctor vec2<T: scalar>(x: T, y: T) -> vec2<T>
+@must_use @const("VecInitS") ctor vec3<T: scalar>(x: T, y: T, z: T) -> vec3<T>
+@must_use @const("VecInitS") ctor vec4<T: scalar>(x: T, y: T, z: T, w: T) -> vec4<T>
-// Vector initializers (mixed)
-@must_use @const("VecInitM") init vec3<T: scalar>(xy: vec2<T>, z: T) -> vec3<T>
-@must_use @const("VecInitM") init vec3<T: scalar>(x: T, yz: vec2<T>) -> vec3<T>
-@must_use @const("VecInitM") init vec4<T: scalar>(xy: vec2<T>, z: T, w: T) -> vec4<T>
-@must_use @const("VecInitM") init vec4<T: scalar>(x: T, yz: vec2<T>, w: T) -> vec4<T>
-@must_use @const("VecInitM") init vec4<T: scalar>(x: T, y: T, zw: vec2<T>) -> vec4<T>
-@must_use @const("VecInitM") init vec4<T: scalar>(xy: vec2<T>, zw: vec2<T>) -> vec4<T>
-@must_use @const("VecInitM") init vec4<T: scalar>(xyz: vec3<T>, w: T) -> vec4<T>
-@must_use @const("VecInitM") init vec4<T: scalar>(x: T, zyw: vec3<T>) -> vec4<T>
+// Vector constructors (mixed)
+@must_use @const("VecInitM") ctor vec3<T: scalar>(xy: vec2<T>, z: T) -> vec3<T>
+@must_use @const("VecInitM") ctor vec3<T: scalar>(x: T, yz: vec2<T>) -> vec3<T>
+@must_use @const("VecInitM") ctor vec4<T: scalar>(xy: vec2<T>, z: T, w: T) -> vec4<T>
+@must_use @const("VecInitM") ctor vec4<T: scalar>(x: T, yz: vec2<T>, w: T) -> vec4<T>
+@must_use @const("VecInitM") ctor vec4<T: scalar>(x: T, y: T, zw: vec2<T>) -> vec4<T>
+@must_use @const("VecInitM") ctor vec4<T: scalar>(xy: vec2<T>, zw: vec2<T>) -> vec4<T>
+@must_use @const("VecInitM") ctor vec4<T: scalar>(xyz: vec3<T>, w: T) -> vec4<T>
+@must_use @const("VecInitM") ctor vec4<T: scalar>(x: T, zyw: vec3<T>) -> vec4<T>
-// Matrix initializers (scalar)
+// Matrix constructors (scalar)
@must_use @const("MatInitS")
-init mat2x2<T: fa_f32_f16>(T, T,
+ctor mat2x2<T: fa_f32_f16>(T, T,
T, T) -> mat2x2<T>
@must_use @const("MatInitS")
-init mat2x3<T: fa_f32_f16>(T, T, T,
+ctor mat2x3<T: fa_f32_f16>(T, T, T,
T, T, T) -> mat2x3<T>
@must_use @const("MatInitS")
-init mat2x4<T: fa_f32_f16>(T, T, T, T,
+ctor mat2x4<T: fa_f32_f16>(T, T, T, T,
T, T, T, T) -> mat2x4<T>
@must_use @const("MatInitS")
-init mat3x2<T: fa_f32_f16>(T, T,
+ctor mat3x2<T: fa_f32_f16>(T, T,
T, T,
T, T) -> mat3x2<T>
@must_use @const("MatInitS")
-init mat3x3<T: fa_f32_f16>(T, T, T,
+ctor mat3x3<T: fa_f32_f16>(T, T, T,
T, T, T,
T, T, T) -> mat3x3<T>
@must_use @const("MatInitS")
-init mat3x4<T: fa_f32_f16>(T, T, T, T,
+ctor mat3x4<T: fa_f32_f16>(T, T, T, T,
T, T, T, T,
T, T, T, T) -> mat3x4<T>
@must_use @const("MatInitS")
-init mat4x2<T: fa_f32_f16>(T, T,
+ctor mat4x2<T: fa_f32_f16>(T, T,
T, T,
T, T,
T, T) -> mat4x2<T>
@must_use @const("MatInitS")
-init mat4x3<T: fa_f32_f16>(T, T, T,
+ctor mat4x3<T: fa_f32_f16>(T, T, T,
T, T, T,
T, T, T,
T, T, T) -> mat4x3<T>
@must_use @const("MatInitS")
-init mat4x4<T: fa_f32_f16>(T, T, T, T,
+ctor mat4x4<T: fa_f32_f16>(T, T, T, T,
T, T, T, T,
T, T, T, T,
T, T, T, T) -> mat4x4<T>
-// Matrix initializers (column vectors)
-@must_use @const("MatInitV") init mat2x2<T: fa_f32_f16>(vec2<T>, vec2<T>) -> mat2x2<T>
-@must_use @const("MatInitV") init mat2x3<T: fa_f32_f16>(vec3<T>, vec3<T>) -> mat2x3<T>
-@must_use @const("MatInitV") init mat2x4<T: fa_f32_f16>(vec4<T>, vec4<T>) -> mat2x4<T>
-@must_use @const("MatInitV") init mat3x2<T: fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>) -> mat3x2<T>
-@must_use @const("MatInitV") init mat3x3<T: fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>) -> mat3x3<T>
-@must_use @const("MatInitV") init mat3x4<T: fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>) -> mat3x4<T>
-@must_use @const("MatInitV") init mat4x2<T: fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>, vec2<T>) -> mat4x2<T>
-@must_use @const("MatInitV") init mat4x3<T: fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>, vec3<T>) -> mat4x3<T>
-@must_use @const("MatInitV") init mat4x4<T: fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>, vec4<T>) -> mat4x4<T>
+// Matrix constructors (column vectors)
+@must_use @const("MatInitV") ctor mat2x2<T: fa_f32_f16>(vec2<T>, vec2<T>) -> mat2x2<T>
+@must_use @const("MatInitV") ctor mat2x3<T: fa_f32_f16>(vec3<T>, vec3<T>) -> mat2x3<T>
+@must_use @const("MatInitV") ctor mat2x4<T: fa_f32_f16>(vec4<T>, vec4<T>) -> mat2x4<T>
+@must_use @const("MatInitV") ctor mat3x2<T: fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>) -> mat3x2<T>
+@must_use @const("MatInitV") ctor mat3x3<T: fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>) -> mat3x3<T>
+@must_use @const("MatInitV") ctor mat3x4<T: fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>) -> mat3x4<T>
+@must_use @const("MatInitV") ctor mat4x2<T: fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>, vec2<T>) -> mat4x2<T>
+@must_use @const("MatInitV") ctor mat4x3<T: fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>, vec3<T>) -> mat4x3<T>
+@must_use @const("MatInitV") ctor mat4x4<T: fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>, vec4<T>) -> mat4x4<T>
////////////////////////////////////////////////////////////////////////////////
-// Type conversions //
+// Value conversions //
////////////////////////////////////////////////////////////////////////////////
@must_use @const conv f32<T: scalar_no_f32>(T) -> f32
@must_use @const conv f16<T: scalar_no_f16>(T) -> f16
diff --git a/src/tint/program_builder.h b/src/tint/program_builder.h
index a1e3eed..c84a6e0 100644
--- a/src/tint/program_builder.h
+++ b/src/tint/program_builder.h
@@ -473,7 +473,7 @@
/// Creates a new ast::Node owned by the ProgramBuilder. When the
/// ProgramBuilder is destructed, the ast::Node will also be destructed.
/// @param source the Source of the node
- /// @param args the arguments to pass to the type constructor
+ /// @param args the arguments to pass to the constructor
/// @returns the node pointer
template <typename T, typename... ARGS>
traits::EnableIfIsType<T, ast::Node>* create(const Source& source, ARGS&&... args) {
@@ -498,8 +498,8 @@
/// constructor.
/// When the ProgramBuilder is destructed, the ast::Node will also be
/// destructed.
- /// @param arg0 the first arguments to pass to the type constructor
- /// @param args the remaining arguments to pass to the type constructor
+ /// @param arg0 the first arguments to pass to the constructor
+ /// @param args the remaining arguments to pass to the constructor
/// @returns the node pointer
template <typename T, typename ARG0, typename... ARGS>
traits::EnableIf</* T is ast::Node and ARG0 is not Source */
@@ -1706,7 +1706,7 @@
/// @param type the vector type
/// @param size the vector size
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a `size`-element vector of
/// type `type`, constructed with the values @p args.
template <typename... ARGS>
@@ -1717,7 +1717,7 @@
/// @param source the source of the call
/// @param type the vector type
/// @param size the vector size
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a `size`-element vector of
/// type `type`, constructed with the values @p args.
template <typename... ARGS>
@@ -1728,7 +1728,7 @@
return Call(source, ty.vec(type, size), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 2-element vector of type `T`, constructed with the
/// values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1737,7 +1737,7 @@
}
/// @param source the vector source
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 2-element vector of type `T`, constructed with the
/// values @p args.
template <typename T, typename... ARGS>
@@ -1746,7 +1746,7 @@
}
/// @param type the element type of the vector
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 2-element vector of type @p type, constructed with the
/// values @p args.
template <typename... ARGS>
@@ -1756,7 +1756,7 @@
/// @param source the vector source
/// @param type the element type of the vector
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 2-element vector of type @p type, constructed with the
/// values @p args.
template <typename... ARGS>
@@ -1764,7 +1764,7 @@
return Call(source, ty.vec2(type), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 3-element vector of type `T`, constructed with the
/// values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1773,7 +1773,7 @@
}
/// @param source the vector source
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 3-element vector of type `T`, constructed with the
/// values @p args.
template <typename T, typename... ARGS>
@@ -1782,7 +1782,7 @@
}
/// @param type the element type of the vector
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 3-element vector of type @p type, constructed with the
/// values @p args.
template <typename... ARGS>
@@ -1792,7 +1792,7 @@
/// @param source the vector source
/// @param type the element type of the vector
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 3-element vector of type @p type, constructed with the
/// values @p args.
template <typename... ARGS>
@@ -1800,7 +1800,7 @@
return Call(source, ty.vec3(type), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 4-element vector of type `T`, constructed with the
/// values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1809,7 +1809,7 @@
}
/// @param source the vector source
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 4-element vector of type `T`, constructed with the
/// values @p args.
template <typename T, typename... ARGS>
@@ -1818,7 +1818,7 @@
}
/// @param type the element type of the vector
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 4-element vector of type @p type, constructed with the
/// values @p args.
template <typename... ARGS>
@@ -1828,7 +1828,7 @@
/// @param source the vector source
/// @param type the element type of the vector
- /// @param args the arguments for the vector initializer
+ /// @param args the arguments for the vector constructor
/// @return an `ast::CallExpression` of a 4-element vector of type @p type, constructed with the
/// values @p args.
template <typename... ARGS>
@@ -1836,7 +1836,7 @@
return Call(source, ty.vec4(type), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 2x2 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1845,7 +1845,7 @@
}
/// @param source the matrix source
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 2x2 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS>
@@ -1853,7 +1853,7 @@
return Call(source, ty.mat2x2<T>(), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 2x3 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1862,7 +1862,7 @@
}
/// @param source the matrix source
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 2x3 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS>
@@ -1870,7 +1870,7 @@
return Call(source, ty.mat2x3<T>(), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 2x4 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1879,7 +1879,7 @@
}
/// @param source the matrix source
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 2x4 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS>
@@ -1887,7 +1887,7 @@
return Call(source, ty.mat2x4<T>(), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 3x2 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1896,7 +1896,7 @@
}
/// @param source the matrix source
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 3x2 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS>
@@ -1904,7 +1904,7 @@
return Call(source, ty.mat3x2<T>(), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 3x3 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1913,7 +1913,7 @@
}
/// @param source the matrix source
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 3x3 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS>
@@ -1921,7 +1921,7 @@
return Call(source, ty.mat3x3<T>(), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 3x4 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1930,7 +1930,7 @@
}
/// @param source the matrix source
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 3x4 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS>
@@ -1938,7 +1938,7 @@
return Call(source, ty.mat3x4<T>(), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 4x2 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1947,7 +1947,7 @@
}
/// @param source the matrix source
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 4x2 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS>
@@ -1955,7 +1955,7 @@
return Call(source, ty.mat4x2<T>(), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 4x3 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1964,7 +1964,7 @@
}
/// @param source the matrix source
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 4x3 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS>
@@ -1972,7 +1972,7 @@
return Call(source, ty.mat4x3<T>(), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 4x4 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1981,7 +1981,7 @@
}
/// @param source the matrix source
- /// @param args the arguments for the matrix initializer
+ /// @param args the arguments for the matrix constructor
/// @return an `ast::CallExpression` of a 4x4 matrix of type
/// `T`, constructed with the values @p args.
template <typename T, typename... ARGS>
@@ -1989,7 +1989,7 @@
return Call(source, ty.mat4x4<T>(), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the array initializer
+ /// @param args the arguments for the array constructor
/// @return an `ast::CallExpression` of an array with element type `T`, constructed with the
/// values @p args.
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -1998,7 +1998,7 @@
}
/// @param source the array source
- /// @param args the arguments for the array initializer
+ /// @param args the arguments for the array constructor
/// @return an `ast::CallExpression` of an array with element type `T`, constructed with the
/// values @p args.
template <typename T, typename... ARGS>
@@ -2006,7 +2006,7 @@
return Call(source, ty.array<T>(), std::forward<ARGS>(args)...);
}
- /// @param args the arguments for the array initializer
+ /// @param args the arguments for the array constructor
/// @return an `ast::CallExpression` of an array with element type `T` and size `N`, constructed
/// with the values @p args.
template <typename T, int N, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -2015,7 +2015,7 @@
}
/// @param source the array source
- /// @param args the arguments for the array initializer
+ /// @param args the arguments for the array constructor
/// @return an `ast::CallExpression` of an array with element type `T` and size `N`, constructed
/// with the values @p args.
template <typename T, int N, typename... ARGS>
@@ -2025,7 +2025,7 @@
/// @param subtype the array element type
/// @param n the array size. nullptr represents a runtime-array.
- /// @param args the arguments for the array initializer
+ /// @param args the arguments for the array constructor
/// @return an `ast::CallExpression` of an array with element type
/// `subtype`, constructed with the values @p args.
template <typename EXPR, typename... ARGS>
@@ -2036,7 +2036,7 @@
/// @param source the array source
/// @param subtype the array element type
/// @param n the array size. nullptr represents a runtime-array.
- /// @param args the arguments for the array initializer
+ /// @param args the arguments for the array constructor
/// @return an `ast::CallExpression` of an array with element type
/// `subtype`, constructed with the values @p args.
template <typename EXPR, typename... ARGS>
@@ -2069,11 +2069,11 @@
/// @param name the variable name
/// @param options the extra options passed to the ast::Var initializer
/// Can be any of the following, in any order:
- /// * ast::Type - specifies the variable's type
+ /// * ast::Type - specifies the variable's type
/// * builtin::AddressSpace - specifies the variable's address space
/// * builtin::Access - specifies the variable's access control
- /// * ast::Expression* - specifies the variable's initializer expression
- /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
+ /// * ast::Expression* - specifies the variable's initializer expression
+ /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
/// Note that non-repeatable arguments of the same type will use the last argument's value.
/// @returns a `ast::Var` with the given name, type and additional
/// options
@@ -2086,11 +2086,11 @@
/// @param name the variable name
/// @param options the extra options passed to the ast::Var initializer
/// Can be any of the following, in any order:
- /// * ast::Type - specifies the variable's type
+ /// * ast::Type - specifies the variable's type
/// * builtin::AddressSpace - specifies the variable's address space
/// * builtin::Access - specifies the variable's access control
- /// * ast::Expression* - specifies the variable's initializer expression
- /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
+ /// * ast::Expression* - specifies the variable's initializer expression
+ /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
/// Note that non-repeatable arguments of the same type will use the last argument's value.
/// @returns a `ast::Var` with the given name, address_space and type
template <typename NAME, typename... OPTIONS>
@@ -2390,7 +2390,7 @@
Expr(std::forward<EXPR>(expr)));
}
- /// @param args the arguments for the type constructor
+ /// @param args the arguments for the constructor
/// @returns an ast::CallExpression to the type `T`, with the arguments of @p args converted to
/// `ast::Expression`s using Expr().
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
@@ -2399,7 +2399,7 @@
}
/// @param source the source of the call
- /// @param args the arguments for the type constructor
+ /// @param args the arguments for the constructor
/// @returns an ast::CallExpression to the type `T` with the arguments of @p args converted to
/// `ast::Expression`s using Expr().
template <typename T, typename... ARGS>
diff --git a/src/tint/reader/spirv/function.cc b/src/tint/reader/spirv/function.cc
index f94be97..49d4e83 100644
--- a/src/tint/reader/spirv/function.cc
+++ b/src/tint/reader/spirv/function.cc
@@ -3950,7 +3950,7 @@
if (ext_opcode == GLSLstd450Ldexp) {
// WGSL requires the second argument to be signed.
- // Use a type initializer to convert it, which is the same as a bitcast.
+ // Use a value constructor to convert it, which is the same as a bitcast.
// If the value would go from very large positive to negative, then the
// original result would have been infinity. And since WGSL
// implementations may assume that infinities are not present, then we
diff --git a/src/tint/reader/spirv/parser_impl_handle_test.cc b/src/tint/reader/spirv/parser_impl_handle_test.cc
index 60994d5..2413386 100644
--- a/src/tint/reader/spirv/parser_impl_handle_test.cc
+++ b/src/tint/reader/spirv/parser_impl_handle_test.cc
@@ -2937,7 +2937,7 @@
INSTANTIATE_TEST_SUITE_P(
// When SPIR-V wants the result type to be unsigned, we have to
- // insert a type initializer or bitcast for WGSL to do the type
+ // insert a value constructor or bitcast for WGSL to do the type
// coercion. But the algorithm already does that as a matter
// of course.
ImageQuerySizeLod_NonArrayed_UnsignedResult_SignedLevel,
@@ -3002,8 +3002,7 @@
R"(let x_99 : i32 = i32(textureNumLevels(x_20));)"}}));
INSTANTIATE_TEST_SUITE_P(
- // Spot check that a type conversion is inserted when SPIR-V asks for
- // an unsigned int result.
+ // Spot check that a value conversion is inserted when SPIR-V asks for an unsigned int result.
ImageQueryLevels_UnsignedResult,
SpvParserHandleTest_SampledImageAccessTest,
::testing::ValuesIn(std::vector<ImageAccessCase>{
diff --git a/src/tint/reader/wgsl/parser_impl.h b/src/tint/reader/wgsl/parser_impl.h
index 8cd0cdb..34395ed 100644
--- a/src/tint/reader/wgsl/parser_impl.h
+++ b/src/tint/reader/wgsl/parser_impl.h
@@ -838,7 +838,7 @@
/// Creates a new `ast::Node` owned by the Module. When the Module is
/// destructed, the `ast::Node` will also be destructed.
- /// @param args the arguments to pass to the type constructor
+ /// @param args the arguments to pass to the constructor
/// @returns the node pointer
template <typename T, typename... ARGS>
T* create(ARGS&&... args) {
diff --git a/src/tint/resolver/builtin_validation_test.cc b/src/tint/resolver/builtin_validation_test.cc
index 14d40bc..967335d 100644
--- a/src/tint/resolver/builtin_validation_test.cc
+++ b/src/tint/resolver/builtin_validation_test.cc
@@ -16,7 +16,7 @@
#include "src/tint/ast/builtin_texture_helper_test.h"
#include "src/tint/resolver/resolver_test_helper.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
using namespace tint::number_suffixes; // NOLINT
@@ -147,9 +147,9 @@
WrapInFunction(Call(Source{{56, 78}}, "mix", 1_f, 2_f, 3_f));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(), R"(56:78 error: no matching initializer for i32(f32, f32, f32)
+ EXPECT_EQ(r()->error(), R"(56:78 error: no matching constructor for i32(f32, f32, f32)
-2 candidate initializers:
+2 candidate constructors:
i32(i32) -> i32
i32() -> i32
@@ -177,7 +177,7 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: struct initializer has too many inputs: expected 1, found 3)");
+ R"(12:34 error: structure constructor has too many inputs: expected 1, found 3)");
}
TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsStructUsedAsType) {
@@ -309,8 +309,8 @@
auto args = overload.args(this);
auto*& arg_to_replace = (param.position == Position::kFirst) ? args.Front() : args.Back();
- // BuildTextureVariable() uses a Literal for scalars, and a CallExpression for
- // a vector initializer.
+ // BuildTextureVariable() uses a Literal for scalars, and a CallExpression for a vector
+ // constructor.
bool is_vector = arg_to_replace->Is<ast::CallExpression>();
// Make the expression to be replaced, reachable. This keeps the resolver happy.
@@ -366,8 +366,8 @@
auto args = overload.args(this);
auto*& arg_to_replace = (param.position == Position::kFirst) ? args.Front() : args.Back();
- // BuildTextureVariable() uses a Literal for scalars, and a CallExpression for
- // a vector initializer.
+ // BuildTextureVariable() uses a Literal for scalars, and a CallExpression for a vector
+ // constructor.
bool is_vector = arg_to_replace->Is<ast::CallExpression>();
// Make the expression to be replaced, reachable. This keeps the resolver happy.
diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc
index 741c9d8..dc59ccd 100644
--- a/src/tint/resolver/const_eval.cc
+++ b/src/tint/resolver/const_eval.cc
@@ -29,7 +29,7 @@
#include "src/tint/number.h"
#include "src/tint/program_builder.h"
#include "src/tint/sem/member_accessor_expression.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
#include "src/tint/type/abstract_float.h"
#include "src/tint/type/abstract_int.h"
#include "src/tint/type/array.h"
@@ -1228,18 +1228,18 @@
});
}
-ConstEval::Result ConstEval::ArrayOrStructInit(const type::Type* ty,
+ConstEval::Result ConstEval::ArrayOrStructCtor(const type::Type* ty,
utils::VectorRef<const sem::ValueExpression*> args) {
if (args.IsEmpty()) {
return ZeroValue(ty);
}
if (args.Length() == 1 && args[0]->Type() == ty) {
- // Identity initializer.
+ // Identity constructor.
return args[0]->ConstantValue();
}
- // Multiple arguments. Must be a type initializer.
+ // Multiple arguments. Must be a value constructor.
utils::Vector<const constant::Value*, 4> els;
els.Reserve(args.Length());
for (auto* arg : args) {
diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h
index 934924e..969cfe7 100644
--- a/src/tint/resolver/const_eval.h
+++ b/src/tint/resolver/const_eval.h
@@ -80,7 +80,7 @@
/// @param ty the target type - must be an array or initializer
/// @param args the input arguments
/// @return the constructed value, or null if the value cannot be calculated
- Result ArrayOrStructInit(const type::Type* ty,
+ Result ArrayOrStructCtor(const type::Type* ty,
utils::VectorRef<const sem::ValueExpression*> args);
/// @param ty the target type
@@ -127,7 +127,7 @@
// Constant value evaluation methods, to be indirectly called via the intrinsic table
////////////////////////////////////////////////////////////////////////////////////////////////
- /// Type conversion
+ /// Value conversion
/// @param ty the result type
/// @param args the input arguments
/// @param source the source location
@@ -136,7 +136,7 @@
utils::VectorRef<const constant::Value*> args,
const Source& source);
- /// Zero value type initializer
+ /// Zero value constructor
/// @param ty the result type
/// @param args the input arguments (no arguments provided)
/// @param source the source location
@@ -145,7 +145,7 @@
utils::VectorRef<const constant::Value*> args,
const Source& source);
- /// Identity value type initializer
+ /// Identity value constructor
/// @param ty the result type
/// @param args the input arguments
/// @param source the source location
@@ -154,7 +154,7 @@
utils::VectorRef<const constant::Value*> args,
const Source& source);
- /// Vector splat initializer
+ /// Vector splat constructor
/// @param ty the vector type
/// @param args the input arguments
/// @param source the source location
@@ -163,7 +163,7 @@
utils::VectorRef<const constant::Value*> args,
const Source& source);
- /// Vector initializer using scalars
+ /// Vector constructor using scalars
/// @param ty the vector type
/// @param args the input arguments
/// @param source the source location
@@ -172,7 +172,7 @@
utils::VectorRef<const constant::Value*> args,
const Source& source);
- /// Vector initializer using a mix of scalars and smaller vectors
+ /// Vector constructor using a mix of scalars and smaller vectors
/// @param ty the vector type
/// @param args the input arguments
/// @param source the source location
@@ -181,7 +181,7 @@
utils::VectorRef<const constant::Value*> args,
const Source& source);
- /// Matrix initializer using scalar values
+ /// Matrix constructor using scalar values
/// @param ty the matrix type
/// @param args the input arguments
/// @param source the source location
@@ -190,7 +190,7 @@
utils::VectorRef<const constant::Value*> args,
const Source& source);
- /// Matrix initializer using column vectors
+ /// Matrix constructor using column vectors
/// @param ty the matrix type
/// @param args the input arguments
/// @param source the source location
diff --git a/src/tint/resolver/const_eval_binary_op_test.cc b/src/tint/resolver/const_eval_binary_op_test.cc
index ef7453e..e2dec19 100644
--- a/src/tint/resolver/const_eval_binary_op_test.cc
+++ b/src/tint/resolver/const_eval_binary_op_test.cc
@@ -1876,7 +1876,7 @@
}
////////////////////////////////////////////////
-// Short-Circuit Type Init/Convert
+// Short-Circuit value construction / conversion
////////////////////////////////////////////////
// NOTE: Cannot demonstrate short-circuiting an invalid init/convert as const eval of init/convert
@@ -1892,9 +1892,9 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: no matching initializer for vec2<f32>(abstract-float, bool)
+ R"(12:34 error: no matching constructor for vec2<f32>(abstract-float, bool)
-4 candidate initializers:
+4 candidate constructors:
vec2(x: T, y: T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
vec2(T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
vec2(vec2<T>) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
@@ -1919,9 +1919,9 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: no matching initializer for vec2<f32>(abstract-float, bool)
+ R"(12:34 error: no matching constructor for vec2<f32>(abstract-float, bool)
-4 candidate initializers:
+4 candidate constructors:
vec2(x: T, y: T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
vec2(T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
vec2(vec2<T>) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
@@ -1958,7 +1958,7 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- "12:34 error: type in struct initializer does not match struct member type: "
+ "12:34 error: type in structure constructor does not match struct member type: "
"expected 'f32', found 'bool'");
}
@@ -1977,7 +1977,7 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- "12:34 error: type in struct initializer does not match struct member type: "
+ "12:34 error: type in structure constructor does not match struct member type: "
"expected 'f32', found 'bool'");
}
diff --git a/src/tint/resolver/init_conv_intrinsic.cc b/src/tint/resolver/ctor_conv_intrinsic.cc
similarity index 63%
rename from src/tint/resolver/init_conv_intrinsic.cc
rename to src/tint/resolver/ctor_conv_intrinsic.cc
index f9f40bf..3ac3a67 100644
--- a/src/tint/resolver/init_conv_intrinsic.cc
+++ b/src/tint/resolver/ctor_conv_intrinsic.cc
@@ -15,52 +15,52 @@
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
-// src/tint/resolver/init_conv_intrinsic.cc.tmpl
+// src/tint/resolver/ctor_conv_intrinsic.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
-#include "src/tint/resolver/init_conv_intrinsic.h"
+#include "src/tint/resolver/ctor_conv_intrinsic.h"
namespace tint::resolver {
-const char* str(InitConvIntrinsic i) {
+const char* str(CtorConvIntrinsic i) {
switch (i) {
- case InitConvIntrinsic::kNone:
+ case CtorConvIntrinsic::kNone:
return "<none>";
- case InitConvIntrinsic::kI32:
+ case CtorConvIntrinsic::kI32:
return "i32";
- case InitConvIntrinsic::kU32:
+ case CtorConvIntrinsic::kU32:
return "u32";
- case InitConvIntrinsic::kF32:
+ case CtorConvIntrinsic::kF32:
return "f32";
- case InitConvIntrinsic::kF16:
+ case CtorConvIntrinsic::kF16:
return "f16";
- case InitConvIntrinsic::kBool:
+ case CtorConvIntrinsic::kBool:
return "bool";
- case InitConvIntrinsic::kVec2:
+ case CtorConvIntrinsic::kVec2:
return "vec2";
- case InitConvIntrinsic::kVec3:
+ case CtorConvIntrinsic::kVec3:
return "vec3";
- case InitConvIntrinsic::kVec4:
+ case CtorConvIntrinsic::kVec4:
return "vec4";
- case InitConvIntrinsic::kMat2x2:
+ case CtorConvIntrinsic::kMat2x2:
return "mat2x2";
- case InitConvIntrinsic::kMat2x3:
+ case CtorConvIntrinsic::kMat2x3:
return "mat2x3";
- case InitConvIntrinsic::kMat2x4:
+ case CtorConvIntrinsic::kMat2x4:
return "mat2x4";
- case InitConvIntrinsic::kMat3x2:
+ case CtorConvIntrinsic::kMat3x2:
return "mat3x2";
- case InitConvIntrinsic::kMat3x3:
+ case CtorConvIntrinsic::kMat3x3:
return "mat3x3";
- case InitConvIntrinsic::kMat3x4:
+ case CtorConvIntrinsic::kMat3x4:
return "mat3x4";
- case InitConvIntrinsic::kMat4x2:
+ case CtorConvIntrinsic::kMat4x2:
return "mat4x2";
- case InitConvIntrinsic::kMat4x3:
+ case CtorConvIntrinsic::kMat4x3:
return "mat4x3";
- case InitConvIntrinsic::kMat4x4:
+ case CtorConvIntrinsic::kMat4x4:
return "mat4x4";
}
return "<unknown>";
diff --git a/src/tint/resolver/init_conv_intrinsic.cc.tmpl b/src/tint/resolver/ctor_conv_intrinsic.cc.tmpl
similarity index 66%
rename from src/tint/resolver/init_conv_intrinsic.cc.tmpl
rename to src/tint/resolver/ctor_conv_intrinsic.cc.tmpl
index 199cb61..00ac21b 100644
--- a/src/tint/resolver/init_conv_intrinsic.cc.tmpl
+++ b/src/tint/resolver/ctor_conv_intrinsic.cc.tmpl
@@ -1,6 +1,6 @@
{{- /*
--------------------------------------------------------------------------------
-Template file for use with tools/src/cmd/gen to generate init_conv_intrinsic.cc
+Template file for use with tools/src/cmd/gen to generate ctor_conv_intrinsic.cc
To update the generated file, run:
./tools/run gen
@@ -11,16 +11,16 @@
--------------------------------------------------------------------------------
*/ -}}
-#include "src/tint/resolver/init_conv_intrinsic.h"
+#include "src/tint/resolver/ctor_conv_intrinsic.h"
namespace tint::resolver {
-const char* str(InitConvIntrinsic i) {
+const char* str(CtorConvIntrinsic i) {
switch (i) {
- case InitConvIntrinsic::kNone:
+ case CtorConvIntrinsic::kNone:
return "<none>";
-{{- range Sem.InitializersAndConverters }}
- case InitConvIntrinsic::k{{Title .Name}}:
+{{- range Sem.ConstructorsAndConverters }}
+ case CtorConvIntrinsic::k{{Title .Name}}:
return "{{.Name}}";
{{- end }}
}
diff --git a/src/tint/resolver/ctor_conv_intrinsic.h b/src/tint/resolver/ctor_conv_intrinsic.h
new file mode 100644
index 0000000..4ee1c79
--- /dev/null
+++ b/src/tint/resolver/ctor_conv_intrinsic.h
@@ -0,0 +1,99 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// src/tint/resolver/ctor_conv_intrinsic.h.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
+#define SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
+
+#include <cstdint>
+
+namespace tint::resolver {
+
+/// CtorConvIntrinsic is an enumerator of types that have a constructor or converter overload
+/// declared in the intrinsic table.
+enum class CtorConvIntrinsic {
+ kNone = -1,
+ kI32,
+ kU32,
+ kF32,
+ kF16,
+ kBool,
+ kVec2,
+ kVec3,
+ kVec4,
+ kMat2x2,
+ kMat2x3,
+ kMat2x4,
+ kMat3x2,
+ kMat3x3,
+ kMat3x4,
+ kMat4x2,
+ kMat4x3,
+ kMat4x4,
+};
+
+/// @returns the name of the type.
+const char* str(CtorConvIntrinsic i);
+
+/// @param n the width of the vector
+/// @return the CtorConvIntrinsic for a vector of width `n`
+inline CtorConvIntrinsic VectorCtorConvIntrinsic(uint32_t n) {
+ switch (n) {
+ case 2:
+ return CtorConvIntrinsic::kVec2;
+ case 3:
+ return CtorConvIntrinsic::kVec3;
+ case 4:
+ return CtorConvIntrinsic::kVec4;
+ }
+ return CtorConvIntrinsic::kNone;
+}
+
+/// @param c the number of columns in the matrix
+/// @param r the number of rows in the matrix
+/// @return the CtorConvIntrinsic for a matrix with `c` columns and `r` rows
+inline CtorConvIntrinsic MatrixCtorConvIntrinsic(uint32_t c, uint32_t r) {
+ switch ((c - 2) * 3 + (r - 2)) {
+ case 0:
+ return CtorConvIntrinsic::kMat2x2;
+ case 1:
+ return CtorConvIntrinsic::kMat2x3;
+ case 2:
+ return CtorConvIntrinsic::kMat2x4;
+ case 3:
+ return CtorConvIntrinsic::kMat3x2;
+ case 4:
+ return CtorConvIntrinsic::kMat3x3;
+ case 5:
+ return CtorConvIntrinsic::kMat3x4;
+ case 6:
+ return CtorConvIntrinsic::kMat4x2;
+ case 7:
+ return CtorConvIntrinsic::kMat4x3;
+ case 8:
+ return CtorConvIntrinsic::kMat4x4;
+ }
+ return CtorConvIntrinsic::kNone;
+}
+
+} // namespace tint::resolver
+
+#endif // SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
diff --git a/src/tint/resolver/ctor_conv_intrinsic.h.tmpl b/src/tint/resolver/ctor_conv_intrinsic.h.tmpl
new file mode 100644
index 0000000..349f939
--- /dev/null
+++ b/src/tint/resolver/ctor_conv_intrinsic.h.tmpl
@@ -0,0 +1,76 @@
+{{- /*
+--------------------------------------------------------------------------------
+Template file for use with tools/src/cmd/gen to generate ctor_conv_intrinsic.h
+
+To update the generated file, run:
+ ./tools/run gen
+
+See:
+* tools/src/cmd/gen for structures used by this template
+* https://golang.org/pkg/text/template/ for documentation on the template syntax
+--------------------------------------------------------------------------------
+*/ -}}
+
+#ifndef SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
+#define SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
+
+#include <cstdint>
+
+namespace tint::resolver {
+
+/// CtorConvIntrinsic is an enumerator of types that have a constructor or converter overload
+/// declared in the intrinsic table.
+enum class CtorConvIntrinsic {
+ kNone = -1,
+{{- range Sem.ConstructorsAndConverters }}
+ k{{Title .Name}},
+{{- end }}
+};
+
+/// @returns the name of the type.
+const char* str(CtorConvIntrinsic i);
+
+/// @param n the width of the vector
+/// @return the CtorConvIntrinsic for a vector of width `n`
+inline CtorConvIntrinsic VectorCtorConvIntrinsic(uint32_t n) {
+ switch (n) {
+ case 2:
+ return CtorConvIntrinsic::kVec2;
+ case 3:
+ return CtorConvIntrinsic::kVec3;
+ case 4:
+ return CtorConvIntrinsic::kVec4;
+ }
+ return CtorConvIntrinsic::kNone;
+}
+
+/// @param c the number of columns in the matrix
+/// @param r the number of rows in the matrix
+/// @return the CtorConvIntrinsic for a matrix with `c` columns and `r` rows
+inline CtorConvIntrinsic MatrixCtorConvIntrinsic(uint32_t c, uint32_t r) {
+ switch ((c - 2) * 3 + (r - 2)) {
+ case 0:
+ return CtorConvIntrinsic::kMat2x2;
+ case 1:
+ return CtorConvIntrinsic::kMat2x3;
+ case 2:
+ return CtorConvIntrinsic::kMat2x4;
+ case 3:
+ return CtorConvIntrinsic::kMat3x2;
+ case 4:
+ return CtorConvIntrinsic::kMat3x3;
+ case 5:
+ return CtorConvIntrinsic::kMat3x4;
+ case 6:
+ return CtorConvIntrinsic::kMat4x2;
+ case 7:
+ return CtorConvIntrinsic::kMat4x3;
+ case 8:
+ return CtorConvIntrinsic::kMat4x4;
+ }
+ return CtorConvIntrinsic::kNone;
+}
+
+} // namespace tint::resolver
+
+#endif // SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
diff --git a/src/tint/resolver/expression_kind_test.cc b/src/tint/resolver/expression_kind_test.cc
index fb23e14..0b4584d 100644
--- a/src/tint/resolver/expression_kind_test.cc
+++ b/src/tint/resolver/expression_kind_test.cc
@@ -445,7 +445,7 @@
R"(5:6 error: cannot use type 'vec4<f32>' as address space)"},
{Def::kBuiltinType, Use::kBinaryOp,
R"(5:6 error: cannot use type 'vec4<f32>' as value
-7:8 note: are you missing '()' for type initializer?)"},
+7:8 note: are you missing '()' for value constructor?)"},
{Def::kBuiltinType, Use::kBuiltinValue,
R"(5:6 error: cannot use type 'vec4<f32>' as builtin value)"},
{Def::kBuiltinType, Use::kCallExpr, kPass},
@@ -459,11 +459,11 @@
R"(5:6 error: cannot use type 'vec4<f32>' as texel format)"},
{Def::kBuiltinType, Use::kValueExpression,
R"(5:6 error: cannot use type 'vec4<f32>' as value
-7:8 note: are you missing '()' for type initializer?)"},
+7:8 note: are you missing '()' for value constructor?)"},
{Def::kBuiltinType, Use::kVariableType, kPass},
{Def::kBuiltinType, Use::kUnaryOp,
R"(5:6 error: cannot use type 'vec4<f32>' as value
-7:8 note: are you missing '()' for type initializer?)"},
+7:8 note: are you missing '()' for value constructor?)"},
{Def::kBuiltinValue, Use::kAccess,
R"(5:6 error: cannot use builtin value 'position' as access)"},
@@ -602,7 +602,7 @@
{Def::kStruct, Use::kAddressSpace,
R"(5:6 error: cannot use type 'STRUCT' as address space)"},
{Def::kStruct, Use::kBinaryOp, R"(5:6 error: cannot use type 'STRUCT' as value
-7:8 note: are you missing '()' for type initializer?
+7:8 note: are you missing '()' for value constructor?
1:2 note: struct 'STRUCT' declared here)"},
{Def::kStruct, Use::kBuiltinValue,
R"(5:6 error: cannot use type 'STRUCT' as builtin value)"},
@@ -615,12 +615,12 @@
{Def::kStruct, Use::kTexelFormat, R"(5:6 error: cannot use type 'STRUCT' as texel format)"},
{Def::kStruct, Use::kValueExpression,
R"(5:6 error: cannot use type 'STRUCT' as value
-7:8 note: are you missing '()' for type initializer?
+7:8 note: are you missing '()' for value constructor?
1:2 note: struct 'STRUCT' declared here)"},
{Def::kStruct, Use::kVariableType, kPass},
{Def::kStruct, Use::kUnaryOp,
R"(5:6 error: cannot use type 'STRUCT' as value
-7:8 note: are you missing '()' for type initializer?
+7:8 note: are you missing '()' for value constructor?
1:2 note: struct 'STRUCT' declared here)"},
{Def::kTexelFormat, Use::kAccess,
@@ -656,7 +656,7 @@
R"(5:6 error: cannot use type 'i32' as address space)"},
{Def::kTypeAlias, Use::kBinaryOp,
R"(5:6 error: cannot use type 'i32' as value
-7:8 note: are you missing '()' for type initializer?)"},
+7:8 note: are you missing '()' for value constructor?)"},
{Def::kTypeAlias, Use::kBuiltinValue,
R"(5:6 error: cannot use type 'i32' as builtin value)"},
{Def::kTypeAlias, Use::kCallExpr, kPass},
@@ -669,11 +669,11 @@
{Def::kTypeAlias, Use::kTexelFormat, R"(5:6 error: cannot use type 'i32' as texel format)"},
{Def::kTypeAlias, Use::kValueExpression,
R"(5:6 error: cannot use type 'i32' as value
-7:8 note: are you missing '()' for type initializer?)"},
+7:8 note: are you missing '()' for value constructor?)"},
{Def::kTypeAlias, Use::kVariableType, kPass},
{Def::kTypeAlias, Use::kUnaryOp,
R"(5:6 error: cannot use type 'i32' as value
-7:8 note: are you missing '()' for type initializer?)"},
+7:8 note: are you missing '()' for value constructor?)"},
{Def::kVariable, Use::kAccess, R"(5:6 error: cannot use const 'VARIABLE' as access
1:2 note: const 'VARIABLE' declared here)"},
diff --git a/src/tint/resolver/init_conv_intrinsic.h b/src/tint/resolver/init_conv_intrinsic.h
deleted file mode 100644
index 07bb45b..0000000
--- a/src/tint/resolver/init_conv_intrinsic.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2021 The Tint Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-////////////////////////////////////////////////////////////////////////////////
-// File generated by tools/src/cmd/gen
-// using the template:
-// src/tint/resolver/init_conv_intrinsic.h.tmpl
-//
-// Do not modify this file directly
-////////////////////////////////////////////////////////////////////////////////
-
-#ifndef SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
-#define SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
-
-#include <cstdint>
-
-namespace tint::resolver {
-
-/// InitConvIntrinsic is an enumerator of types that have a initializer or converter overload
-/// declared in the intrinsic table.
-enum class InitConvIntrinsic {
- kNone = -1,
- kI32,
- kU32,
- kF32,
- kF16,
- kBool,
- kVec2,
- kVec3,
- kVec4,
- kMat2x2,
- kMat2x3,
- kMat2x4,
- kMat3x2,
- kMat3x3,
- kMat3x4,
- kMat4x2,
- kMat4x3,
- kMat4x4,
-};
-
-/// @returns the name of the type.
-const char* str(InitConvIntrinsic i);
-
-/// @param n the width of the vector
-/// @return the InitConvIntrinsic for a vector of width `n`
-inline InitConvIntrinsic VectorInitConvIntrinsic(uint32_t n) {
- switch (n) {
- case 2:
- return InitConvIntrinsic::kVec2;
- case 3:
- return InitConvIntrinsic::kVec3;
- case 4:
- return InitConvIntrinsic::kVec4;
- }
- return InitConvIntrinsic::kNone;
-}
-
-/// @param c the number of columns in the matrix
-/// @param r the number of rows in the matrix
-/// @return the InitConvIntrinsic for a matrix with `c` columns and `r` rows
-inline InitConvIntrinsic MatrixInitConvIntrinsic(uint32_t c, uint32_t r) {
- switch ((c - 2) * 3 + (r - 2)) {
- case 0:
- return InitConvIntrinsic::kMat2x2;
- case 1:
- return InitConvIntrinsic::kMat2x3;
- case 2:
- return InitConvIntrinsic::kMat2x4;
- case 3:
- return InitConvIntrinsic::kMat3x2;
- case 4:
- return InitConvIntrinsic::kMat3x3;
- case 5:
- return InitConvIntrinsic::kMat3x4;
- case 6:
- return InitConvIntrinsic::kMat4x2;
- case 7:
- return InitConvIntrinsic::kMat4x3;
- case 8:
- return InitConvIntrinsic::kMat4x4;
- }
- return InitConvIntrinsic::kNone;
-}
-
-} // namespace tint::resolver
-
-#endif // SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
diff --git a/src/tint/resolver/init_conv_intrinsic.h.tmpl b/src/tint/resolver/init_conv_intrinsic.h.tmpl
deleted file mode 100644
index 5f1281b..0000000
--- a/src/tint/resolver/init_conv_intrinsic.h.tmpl
+++ /dev/null
@@ -1,76 +0,0 @@
-{{- /*
---------------------------------------------------------------------------------
-Template file for use with tools/src/cmd/gen to generate init_conv_intrinsic.h
-
-To update the generated file, run:
- ./tools/run gen
-
-See:
-* tools/src/cmd/gen for structures used by this template
-* https://golang.org/pkg/text/template/ for documentation on the template syntax
---------------------------------------------------------------------------------
-*/ -}}
-
-#ifndef SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
-#define SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
-
-#include <cstdint>
-
-namespace tint::resolver {
-
-/// InitConvIntrinsic is an enumerator of types that have a initializer or converter overload
-/// declared in the intrinsic table.
-enum class InitConvIntrinsic {
- kNone = -1,
-{{- range Sem.InitializersAndConverters }}
- k{{Title .Name}},
-{{- end }}
-};
-
-/// @returns the name of the type.
-const char* str(InitConvIntrinsic i);
-
-/// @param n the width of the vector
-/// @return the InitConvIntrinsic for a vector of width `n`
-inline InitConvIntrinsic VectorInitConvIntrinsic(uint32_t n) {
- switch (n) {
- case 2:
- return InitConvIntrinsic::kVec2;
- case 3:
- return InitConvIntrinsic::kVec3;
- case 4:
- return InitConvIntrinsic::kVec4;
- }
- return InitConvIntrinsic::kNone;
-}
-
-/// @param c the number of columns in the matrix
-/// @param r the number of rows in the matrix
-/// @return the InitConvIntrinsic for a matrix with `c` columns and `r` rows
-inline InitConvIntrinsic MatrixInitConvIntrinsic(uint32_t c, uint32_t r) {
- switch ((c - 2) * 3 + (r - 2)) {
- case 0:
- return InitConvIntrinsic::kMat2x2;
- case 1:
- return InitConvIntrinsic::kMat2x3;
- case 2:
- return InitConvIntrinsic::kMat2x4;
- case 3:
- return InitConvIntrinsic::kMat3x2;
- case 4:
- return InitConvIntrinsic::kMat3x3;
- case 5:
- return InitConvIntrinsic::kMat3x4;
- case 6:
- return InitConvIntrinsic::kMat4x2;
- case 7:
- return InitConvIntrinsic::kMat4x3;
- case 8:
- return InitConvIntrinsic::kMat4x4;
- }
- return InitConvIntrinsic::kNone;
-}
-
-} // namespace tint::resolver
-
-#endif // SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
diff --git a/src/tint/resolver/intrinsic_table.cc b/src/tint/resolver/intrinsic_table.cc
index 34e4b5a..17927db 100644
--- a/src/tint/resolver/intrinsic_table.cc
+++ b/src/tint/resolver/intrinsic_table.cc
@@ -22,8 +22,8 @@
#include "src/tint/program_builder.h"
#include "src/tint/sem/evaluation_stage.h"
#include "src/tint/sem/pipeline_stage_set.h"
-#include "src/tint/sem/type_conversion.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/type/abstract_float.h"
#include "src/tint/type/abstract_int.h"
#include "src/tint/type/abstract_numeric.h"
@@ -338,8 +338,8 @@
enum class OverloadFlag {
kIsBuiltin, // The overload is a builtin ('fn')
kIsOperator, // The overload is an operator ('op')
- kIsInitializer, // The overload is a type initializer ('ctor')
- kIsConverter, // The overload is a type converter ('conv')
+ kIsConstructor, // The overload is a value constructor ('ctor')
+ kIsConverter, // The overload is a value converter ('conv')
kSupportsVertexPipeline, // The overload can be used in vertex shaders
kSupportsFragmentPipeline, // The overload can be used in fragment shaders
kSupportsComputePipeline, // The overload can be used in compute shaders
@@ -1093,7 +1093,7 @@
const Source& source,
bool is_compound) override;
- InitOrConv Lookup(InitConvIntrinsic type,
+ CtorOrConv Lookup(CtorConvIntrinsic type,
const type::Type* template_arg,
utils::VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
@@ -1201,9 +1201,9 @@
ProgramBuilder& builder;
Matchers matchers;
utils::Hashmap<IntrinsicPrototype, sem::Builtin*, 64, IntrinsicPrototype::Hasher> builtins;
- utils::Hashmap<IntrinsicPrototype, sem::TypeInitializer*, 16, IntrinsicPrototype::Hasher>
- initializers;
- utils::Hashmap<IntrinsicPrototype, sem::TypeConversion*, 16, IntrinsicPrototype::Hasher>
+ utils::Hashmap<IntrinsicPrototype, sem::ValueConstructor*, 16, IntrinsicPrototype::Hasher>
+ constructors;
+ utils::Hashmap<IntrinsicPrototype, sem::ValueConversion*, 16, IntrinsicPrototype::Hasher>
converters;
};
@@ -1425,7 +1425,7 @@
};
}
-IntrinsicTable::InitOrConv Impl::Lookup(InitConvIntrinsic type,
+IntrinsicTable::CtorOrConv Impl::Lookup(CtorConvIntrinsic type,
const type::Type* template_arg,
utils::VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
@@ -1435,11 +1435,11 @@
// Generates an error when no overloads match the provided arguments
auto on_no_match = [&](utils::VectorRef<Candidate> candidates) {
std::stringstream ss;
- ss << "no matching initializer for " << CallSignature(builder, name, args, template_arg)
+ ss << "no matching constructor for " << CallSignature(builder, name, args, template_arg)
<< std::endl;
Candidates ctor, conv;
for (auto candidate : candidates) {
- if (candidate.overload->flags.Contains(OverloadFlag::kIsInitializer)) {
+ if (candidate.overload->flags.Contains(OverloadFlag::kIsConstructor)) {
ctor.Push(candidate);
} else {
conv.Push(candidate);
@@ -1447,7 +1447,7 @@
}
if (!ctor.IsEmpty()) {
ss << std::endl
- << ctor.Length() << " candidate initializer" << (ctor.Length() > 1 ? "s:" : ":")
+ << ctor.Length() << " candidate constructor" << (ctor.Length() > 1 ? "s:" : ":")
<< std::endl;
PrintCandidates(ss, ctor, name);
}
@@ -1467,14 +1467,14 @@
}
// Resolve the intrinsic overload
- auto match = MatchIntrinsic(kInitializersAndConverters[static_cast<size_t>(type)], name, args,
+ auto match = MatchIntrinsic(kConstructorsAndConverters[static_cast<size_t>(type)], name, args,
earliest_eval_stage, templates, on_no_match);
if (!match.overload) {
return {};
}
- // Was this overload a initializer or conversion?
- if (match.overload->flags.Contains(OverloadFlag::kIsInitializer)) {
+ // Was this overload a constructor or conversion?
+ if (match.overload->flags.Contains(OverloadFlag::kIsConstructor)) {
utils::Vector<const sem::Parameter*, 8> params;
params.Reserve(match.parameters.Length());
for (auto& p : match.parameters) {
@@ -1484,11 +1484,11 @@
}
auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant
: sem::EvaluationStage::kRuntime;
- auto* target = initializers.GetOrCreate(match, [&]() {
- return builder.create<sem::TypeInitializer>(match.return_type, std::move(params),
- eval_stage);
+ auto* target = constructors.GetOrCreate(match, [&]() {
+ return builder.create<sem::ValueConstructor>(match.return_type, std::move(params),
+ eval_stage);
});
- return InitOrConv{target, match.overload->const_eval_fn};
+ return CtorOrConv{target, match.overload->const_eval_fn};
}
// Conversion.
@@ -1498,9 +1498,9 @@
builtin::Access::kUndefined, match.parameters[0].usage);
auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant
: sem::EvaluationStage::kRuntime;
- return builder.create<sem::TypeConversion>(match.return_type, param, eval_stage);
+ return builder.create<sem::ValueConversion>(match.return_type, param, eval_stage);
});
- return InitOrConv{target, match.overload->const_eval_fn};
+ return CtorOrConv{target, match.overload->const_eval_fn};
}
IntrinsicPrototype Impl::MatchIntrinsic(const IntrinsicInfo& intrinsic,
@@ -1753,8 +1753,8 @@
// e.g. vec3<T>(vec3<U>) -> vec3<f32>
print_template_type = true;
} else if ((overload->num_parameters == 0) &&
- overload->flags.Contains(OverloadFlag::kIsInitializer)) {
- // Print for initializers with no params
+ overload->flags.Contains(OverloadFlag::kIsConstructor)) {
+ // Print for constructors with no params
// e.g. vec2<T>() -> vec2<T>
print_template_type = true;
}
diff --git a/src/tint/resolver/intrinsic_table.h b/src/tint/resolver/intrinsic_table.h
index c49ed50..515e839 100644
--- a/src/tint/resolver/intrinsic_table.h
+++ b/src/tint/resolver/intrinsic_table.h
@@ -21,7 +21,7 @@
#include "src/tint/ast/binary_expression.h"
#include "src/tint/ast/unary_op.h"
#include "src/tint/resolver/const_eval.h"
-#include "src/tint/resolver/init_conv_intrinsic.h"
+#include "src/tint/resolver/ctor_conv_intrinsic.h"
#include "src/tint/sem/builtin.h"
#include "src/tint/utils/vector.h"
@@ -72,9 +72,9 @@
ConstEval::Function const_eval_fn = nullptr;
};
- /// InitOrConv describes a resolved type initializer or type conversion
- struct InitOrConv {
- /// The result type of the type initializer or type conversion
+ /// CtorOrConv describes a resolved value constructor or conversion
+ struct CtorOrConv {
+ /// The result type of the value constructor or conversion
const sem::CallTarget* target = nullptr;
/// The constant evaluation function
ConstEval::Function const_eval_fn = nullptr;
@@ -137,20 +137,20 @@
const Source& source,
bool is_compound) = 0;
- /// Lookup looks for the type initializer or conversion overload for the given
- /// InitConvIntrinsic.
+ /// Lookup looks for the value constructor or conversion overload for the given
+ /// CtorConvIntrinsic.
/// @param type the type being constructed or converted
/// @param template_arg the optional template argument
- /// @param args the argument types passed to the initializer / conversion call
+ /// @param args the argument types passed to the constructor / conversion call
/// @param earliest_eval_stage the the earliest evaluation stage that a call to
- /// the initializer or conversion can be made. This can alter the overloads considered.
+ /// the constructor or conversion can be made. This can alter the overloads considered.
/// For example, if the earliest evaluation stage is
/// `sem::EvaluationStage::kRuntime`, then only overloads with concrete argument types
/// will be considered, as all abstract-numerics will have been materialized
/// after shader creation time (sem::EvaluationStage::kConstant).
/// @param source the source of the call
- /// @return a sem::TypeInitializer, sem::TypeConversion or nullptr if nothing matched
- virtual InitOrConv Lookup(InitConvIntrinsic type,
+ /// @return a sem::ValueConstructor, sem::ValueConversion or nullptr if nothing matched
+ virtual CtorOrConv Lookup(CtorConvIntrinsic type,
const type::Type* template_arg,
utils::VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl
index fcda04f..3d15e1f 100644
--- a/src/tint/resolver/intrinsic_table.inl
+++ b/src/tint/resolver/intrinsic_table.inl
@@ -8881,7 +8881,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[134],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -8893,7 +8893,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[979],
/* return matcher indices */ &kMatcherIndices[134],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -8905,7 +8905,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[980],
/* return matcher indices */ &kMatcherIndices[134],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecSplat,
},
{
@@ -8917,7 +8917,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[427],
/* return matcher indices */ &kMatcherIndices[134],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitS,
},
{
@@ -8929,7 +8929,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[576],
/* return matcher indices */ &kMatcherIndices[134],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitM,
},
{
@@ -8941,7 +8941,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[579],
/* return matcher indices */ &kMatcherIndices[134],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitM,
},
{
@@ -8953,7 +8953,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[582],
/* return matcher indices */ &kMatcherIndices[134],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitM,
},
{
@@ -8965,7 +8965,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[788],
/* return matcher indices */ &kMatcherIndices[134],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitM,
},
{
@@ -8977,7 +8977,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[790],
/* return matcher indices */ &kMatcherIndices[134],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitM,
},
{
@@ -8989,7 +8989,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[792],
/* return matcher indices */ &kMatcherIndices[134],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitM,
},
{
@@ -9517,7 +9517,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[106],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -9529,7 +9529,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[972],
/* return matcher indices */ &kMatcherIndices[106],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -9541,7 +9541,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[973],
/* return matcher indices */ &kMatcherIndices[106],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecSplat,
},
{
@@ -9553,7 +9553,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[573],
/* return matcher indices */ &kMatcherIndices[106],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitS,
},
{
@@ -9565,7 +9565,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[784],
/* return matcher indices */ &kMatcherIndices[106],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitM,
},
{
@@ -9577,7 +9577,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[786],
/* return matcher indices */ &kMatcherIndices[106],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitM,
},
{
@@ -9985,7 +9985,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[23],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -9997,7 +9997,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[965],
/* return matcher indices */ &kMatcherIndices[23],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -10009,7 +10009,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[966],
/* return matcher indices */ &kMatcherIndices[23],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecSplat,
},
{
@@ -10021,7 +10021,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[782],
/* return matcher indices */ &kMatcherIndices[23],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::VecInitS,
},
{
@@ -10501,7 +10501,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[178],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -10513,7 +10513,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[986],
/* return matcher indices */ &kMatcherIndices[178],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -10525,7 +10525,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[431],
/* return matcher indices */ &kMatcherIndices[178],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitS,
},
{
@@ -10537,7 +10537,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[794],
/* return matcher indices */ &kMatcherIndices[178],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitV,
},
{
@@ -10573,7 +10573,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[184],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -10585,7 +10585,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[989],
/* return matcher indices */ &kMatcherIndices[184],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -10597,7 +10597,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[138],
/* return matcher indices */ &kMatcherIndices[184],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitS,
},
{
@@ -10609,7 +10609,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[796],
/* return matcher indices */ &kMatcherIndices[184],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitV,
},
{
@@ -10645,7 +10645,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[190],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -10657,7 +10657,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[992],
/* return matcher indices */ &kMatcherIndices[190],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -10669,7 +10669,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[49],
/* return matcher indices */ &kMatcherIndices[190],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitS,
},
{
@@ -10681,7 +10681,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[798],
/* return matcher indices */ &kMatcherIndices[190],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitV,
},
{
@@ -10717,7 +10717,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[196],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -10729,7 +10729,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[995],
/* return matcher indices */ &kMatcherIndices[196],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -10741,7 +10741,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[144],
/* return matcher indices */ &kMatcherIndices[196],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitS,
},
{
@@ -10753,7 +10753,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[585],
/* return matcher indices */ &kMatcherIndices[196],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitV,
},
{
@@ -10789,7 +10789,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[202],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -10801,7 +10801,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[998],
/* return matcher indices */ &kMatcherIndices[202],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -10813,7 +10813,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[40],
/* return matcher indices */ &kMatcherIndices[202],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitS,
},
{
@@ -10825,7 +10825,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[588],
/* return matcher indices */ &kMatcherIndices[202],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitV,
},
{
@@ -10861,7 +10861,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[208],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -10873,7 +10873,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1001],
/* return matcher indices */ &kMatcherIndices[208],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -10885,7 +10885,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[16],
/* return matcher indices */ &kMatcherIndices[208],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitS,
},
{
@@ -10897,7 +10897,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[591],
/* return matcher indices */ &kMatcherIndices[208],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitV,
},
{
@@ -10933,7 +10933,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[214],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -10945,7 +10945,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1004],
/* return matcher indices */ &kMatcherIndices[214],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -10957,7 +10957,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[57],
/* return matcher indices */ &kMatcherIndices[214],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitS,
},
{
@@ -10969,7 +10969,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[435],
/* return matcher indices */ &kMatcherIndices[214],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitV,
},
{
@@ -11005,7 +11005,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[220],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -11017,7 +11017,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1007],
/* return matcher indices */ &kMatcherIndices[220],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -11029,7 +11029,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[28],
/* return matcher indices */ &kMatcherIndices[220],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitS,
},
{
@@ -11041,7 +11041,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[439],
/* return matcher indices */ &kMatcherIndices[220],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitV,
},
{
@@ -11077,7 +11077,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[226],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -11089,7 +11089,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1010],
/* return matcher indices */ &kMatcherIndices[226],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -11101,7 +11101,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[0],
/* return matcher indices */ &kMatcherIndices[226],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitS,
},
{
@@ -11113,7 +11113,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[443],
/* return matcher indices */ &kMatcherIndices[226],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::MatInitV,
},
{
@@ -11593,7 +11593,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[9],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -11605,7 +11605,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[955],
/* return matcher indices */ &kMatcherIndices[9],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -11629,7 +11629,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[105],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -11641,7 +11641,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[957],
/* return matcher indices */ &kMatcherIndices[105],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -11665,7 +11665,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[42],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -11677,7 +11677,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[959],
/* return matcher indices */ &kMatcherIndices[42],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -11701,7 +11701,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[1],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -11713,7 +11713,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[961],
/* return matcher indices */ &kMatcherIndices[1],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -11737,7 +11737,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[1013],
/* return matcher indices */ &kMatcherIndices[39],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Zero,
},
{
@@ -11749,7 +11749,7 @@
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[963],
/* return matcher indices */ &kMatcherIndices[39],
- /* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
+ /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
/* const eval */ &ConstEval::Identity,
},
{
@@ -15094,53 +15094,53 @@
constexpr uint8_t kBinaryOperatorShiftLeft = 16;
constexpr uint8_t kBinaryOperatorShiftRight = 17;
-constexpr IntrinsicInfo kInitializersAndConverters[] = {
+constexpr IntrinsicInfo kConstructorsAndConverters[] = {
{
/* [0] */
- /* init i32() -> i32 */
- /* init i32(i32) -> i32 */
+ /* ctor i32() -> i32 */
+ /* ctor i32(i32) -> i32 */
/* conv i32<T : scalar_no_i32>(T) -> i32 */
/* num overloads */ 3,
/* overloads */ &kOverloads[268],
},
{
/* [1] */
- /* init u32() -> u32 */
- /* init u32(u32) -> u32 */
+ /* ctor u32() -> u32 */
+ /* ctor u32(u32) -> u32 */
/* conv u32<T : scalar_no_u32>(T) -> u32 */
/* num overloads */ 3,
/* overloads */ &kOverloads[271],
},
{
/* [2] */
- /* init f32() -> f32 */
- /* init f32(f32) -> f32 */
+ /* ctor f32() -> f32 */
+ /* ctor f32(f32) -> f32 */
/* conv f32<T : scalar_no_f32>(T) -> f32 */
/* num overloads */ 3,
/* overloads */ &kOverloads[274],
},
{
/* [3] */
- /* init f16() -> f16 */
- /* init f16(f16) -> f16 */
+ /* ctor f16() -> f16 */
+ /* ctor f16(f16) -> f16 */
/* conv f16<T : scalar_no_f16>(T) -> f16 */
/* num overloads */ 3,
/* overloads */ &kOverloads[277],
},
{
/* [4] */
- /* init bool() -> bool */
- /* init bool(bool) -> bool */
+ /* ctor bool() -> bool */
+ /* ctor bool(bool) -> bool */
/* conv bool<T : scalar_no_bool>(T) -> bool */
/* num overloads */ 3,
/* overloads */ &kOverloads[280],
},
{
/* [5] */
- /* init vec2<T : concrete_scalar>() -> vec2<T> */
- /* init vec2<T : scalar>(vec2<T>) -> vec2<T> */
- /* init vec2<T : scalar>(T) -> vec2<T> */
- /* init vec2<T : scalar>(x: T, y: T) -> vec2<T> */
+ /* ctor vec2<T : concrete_scalar>() -> vec2<T> */
+ /* ctor vec2<T : scalar>(vec2<T>) -> vec2<T> */
+ /* ctor vec2<T : scalar>(T) -> vec2<T> */
+ /* ctor vec2<T : scalar>(x: T, y: T) -> vec2<T> */
/* conv vec2<T : f32, U : scalar_no_f32>(vec2<U>) -> vec2<f32> */
/* conv vec2<T : f16, U : scalar_no_f16>(vec2<U>) -> vec2<f16> */
/* conv vec2<T : i32, U : scalar_no_i32>(vec2<U>) -> vec2<i32> */
@@ -15151,12 +15151,12 @@
},
{
/* [6] */
- /* init vec3<T : concrete_scalar>() -> vec3<T> */
- /* init vec3<T : scalar>(vec3<T>) -> vec3<T> */
- /* init vec3<T : scalar>(T) -> vec3<T> */
- /* init vec3<T : scalar>(x: T, y: T, z: T) -> vec3<T> */
- /* init vec3<T : scalar>(xy: vec2<T>, z: T) -> vec3<T> */
- /* init vec3<T : scalar>(x: T, yz: vec2<T>) -> vec3<T> */
+ /* ctor vec3<T : concrete_scalar>() -> vec3<T> */
+ /* ctor vec3<T : scalar>(vec3<T>) -> vec3<T> */
+ /* ctor vec3<T : scalar>(T) -> vec3<T> */
+ /* ctor vec3<T : scalar>(x: T, y: T, z: T) -> vec3<T> */
+ /* ctor vec3<T : scalar>(xy: vec2<T>, z: T) -> vec3<T> */
+ /* ctor vec3<T : scalar>(x: T, yz: vec2<T>) -> vec3<T> */
/* conv vec3<T : f32, U : scalar_no_f32>(vec3<U>) -> vec3<f32> */
/* conv vec3<T : f16, U : scalar_no_f16>(vec3<U>) -> vec3<f16> */
/* conv vec3<T : i32, U : scalar_no_i32>(vec3<U>) -> vec3<i32> */
@@ -15167,16 +15167,16 @@
},
{
/* [7] */
- /* init vec4<T : concrete_scalar>() -> vec4<T> */
- /* init vec4<T : scalar>(vec4<T>) -> vec4<T> */
- /* init vec4<T : scalar>(T) -> vec4<T> */
- /* init vec4<T : scalar>(x: T, y: T, z: T, w: T) -> vec4<T> */
- /* init vec4<T : scalar>(xy: vec2<T>, z: T, w: T) -> vec4<T> */
- /* init vec4<T : scalar>(x: T, yz: vec2<T>, w: T) -> vec4<T> */
- /* init vec4<T : scalar>(x: T, y: T, zw: vec2<T>) -> vec4<T> */
- /* init vec4<T : scalar>(xy: vec2<T>, zw: vec2<T>) -> vec4<T> */
- /* init vec4<T : scalar>(xyz: vec3<T>, w: T) -> vec4<T> */
- /* init vec4<T : scalar>(x: T, zyw: vec3<T>) -> vec4<T> */
+ /* ctor vec4<T : concrete_scalar>() -> vec4<T> */
+ /* ctor vec4<T : scalar>(vec4<T>) -> vec4<T> */
+ /* ctor vec4<T : scalar>(T) -> vec4<T> */
+ /* ctor vec4<T : scalar>(x: T, y: T, z: T, w: T) -> vec4<T> */
+ /* ctor vec4<T : scalar>(xy: vec2<T>, z: T, w: T) -> vec4<T> */
+ /* ctor vec4<T : scalar>(x: T, yz: vec2<T>, w: T) -> vec4<T> */
+ /* ctor vec4<T : scalar>(x: T, y: T, zw: vec2<T>) -> vec4<T> */
+ /* ctor vec4<T : scalar>(xy: vec2<T>, zw: vec2<T>) -> vec4<T> */
+ /* ctor vec4<T : scalar>(xyz: vec3<T>, w: T) -> vec4<T> */
+ /* ctor vec4<T : scalar>(x: T, zyw: vec3<T>) -> vec4<T> */
/* conv vec4<T : f32, U : scalar_no_f32>(vec4<U>) -> vec4<f32> */
/* conv vec4<T : f16, U : scalar_no_f16>(vec4<U>) -> vec4<f16> */
/* conv vec4<T : i32, U : scalar_no_i32>(vec4<U>) -> vec4<i32> */
@@ -15187,10 +15187,10 @@
},
{
/* [8] */
- /* init mat2x2<T : f32_f16>() -> mat2x2<T> */
- /* init mat2x2<T : f32_f16>(mat2x2<T>) -> mat2x2<T> */
- /* init mat2x2<T : fa_f32_f16>(T, T, T, T) -> mat2x2<T> */
- /* init mat2x2<T : fa_f32_f16>(vec2<T>, vec2<T>) -> mat2x2<T> */
+ /* ctor mat2x2<T : f32_f16>() -> mat2x2<T> */
+ /* ctor mat2x2<T : f32_f16>(mat2x2<T>) -> mat2x2<T> */
+ /* ctor mat2x2<T : fa_f32_f16>(T, T, T, T) -> mat2x2<T> */
+ /* ctor mat2x2<T : fa_f32_f16>(vec2<T>, vec2<T>) -> mat2x2<T> */
/* conv mat2x2<T : f16>(mat2x2<f32>) -> mat2x2<f16> */
/* conv mat2x2<T : f32>(mat2x2<f16>) -> mat2x2<f32> */
/* num overloads */ 6,
@@ -15198,10 +15198,10 @@
},
{
/* [9] */
- /* init mat2x3<T : f32_f16>() -> mat2x3<T> */
- /* init mat2x3<T : f32_f16>(mat2x3<T>) -> mat2x3<T> */
- /* init mat2x3<T : fa_f32_f16>(T, T, T, T, T, T) -> mat2x3<T> */
- /* init mat2x3<T : fa_f32_f16>(vec3<T>, vec3<T>) -> mat2x3<T> */
+ /* ctor mat2x3<T : f32_f16>() -> mat2x3<T> */
+ /* ctor mat2x3<T : f32_f16>(mat2x3<T>) -> mat2x3<T> */
+ /* ctor mat2x3<T : fa_f32_f16>(T, T, T, T, T, T) -> mat2x3<T> */
+ /* ctor mat2x3<T : fa_f32_f16>(vec3<T>, vec3<T>) -> mat2x3<T> */
/* conv mat2x3<T : f16>(mat2x3<f32>) -> mat2x3<f16> */
/* conv mat2x3<T : f32>(mat2x3<f16>) -> mat2x3<f32> */
/* num overloads */ 6,
@@ -15209,10 +15209,10 @@
},
{
/* [10] */
- /* init mat2x4<T : f32_f16>() -> mat2x4<T> */
- /* init mat2x4<T : f32_f16>(mat2x4<T>) -> mat2x4<T> */
- /* init mat2x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T) -> mat2x4<T> */
- /* init mat2x4<T : fa_f32_f16>(vec4<T>, vec4<T>) -> mat2x4<T> */
+ /* ctor mat2x4<T : f32_f16>() -> mat2x4<T> */
+ /* ctor mat2x4<T : f32_f16>(mat2x4<T>) -> mat2x4<T> */
+ /* ctor mat2x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T) -> mat2x4<T> */
+ /* ctor mat2x4<T : fa_f32_f16>(vec4<T>, vec4<T>) -> mat2x4<T> */
/* conv mat2x4<T : f16>(mat2x4<f32>) -> mat2x4<f16> */
/* conv mat2x4<T : f32>(mat2x4<f16>) -> mat2x4<f32> */
/* num overloads */ 6,
@@ -15220,10 +15220,10 @@
},
{
/* [11] */
- /* init mat3x2<T : f32_f16>() -> mat3x2<T> */
- /* init mat3x2<T : f32_f16>(mat3x2<T>) -> mat3x2<T> */
- /* init mat3x2<T : fa_f32_f16>(T, T, T, T, T, T) -> mat3x2<T> */
- /* init mat3x2<T : fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>) -> mat3x2<T> */
+ /* ctor mat3x2<T : f32_f16>() -> mat3x2<T> */
+ /* ctor mat3x2<T : f32_f16>(mat3x2<T>) -> mat3x2<T> */
+ /* ctor mat3x2<T : fa_f32_f16>(T, T, T, T, T, T) -> mat3x2<T> */
+ /* ctor mat3x2<T : fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>) -> mat3x2<T> */
/* conv mat3x2<T : f16>(mat3x2<f32>) -> mat3x2<f16> */
/* conv mat3x2<T : f32>(mat3x2<f16>) -> mat3x2<f32> */
/* num overloads */ 6,
@@ -15231,10 +15231,10 @@
},
{
/* [12] */
- /* init mat3x3<T : f32_f16>() -> mat3x3<T> */
- /* init mat3x3<T : f32_f16>(mat3x3<T>) -> mat3x3<T> */
- /* init mat3x3<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T) -> mat3x3<T> */
- /* init mat3x3<T : fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>) -> mat3x3<T> */
+ /* ctor mat3x3<T : f32_f16>() -> mat3x3<T> */
+ /* ctor mat3x3<T : f32_f16>(mat3x3<T>) -> mat3x3<T> */
+ /* ctor mat3x3<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T) -> mat3x3<T> */
+ /* ctor mat3x3<T : fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>) -> mat3x3<T> */
/* conv mat3x3<T : f16>(mat3x3<f32>) -> mat3x3<f16> */
/* conv mat3x3<T : f32>(mat3x3<f16>) -> mat3x3<f32> */
/* num overloads */ 6,
@@ -15242,10 +15242,10 @@
},
{
/* [13] */
- /* init mat3x4<T : f32_f16>() -> mat3x4<T> */
- /* init mat3x4<T : f32_f16>(mat3x4<T>) -> mat3x4<T> */
- /* init mat3x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T) -> mat3x4<T> */
- /* init mat3x4<T : fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>) -> mat3x4<T> */
+ /* ctor mat3x4<T : f32_f16>() -> mat3x4<T> */
+ /* ctor mat3x4<T : f32_f16>(mat3x4<T>) -> mat3x4<T> */
+ /* ctor mat3x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T) -> mat3x4<T> */
+ /* ctor mat3x4<T : fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>) -> mat3x4<T> */
/* conv mat3x4<T : f16>(mat3x4<f32>) -> mat3x4<f16> */
/* conv mat3x4<T : f32>(mat3x4<f16>) -> mat3x4<f32> */
/* num overloads */ 6,
@@ -15253,10 +15253,10 @@
},
{
/* [14] */
- /* init mat4x2<T : f32_f16>() -> mat4x2<T> */
- /* init mat4x2<T : f32_f16>(mat4x2<T>) -> mat4x2<T> */
- /* init mat4x2<T : fa_f32_f16>(T, T, T, T, T, T, T, T) -> mat4x2<T> */
- /* init mat4x2<T : fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>, vec2<T>) -> mat4x2<T> */
+ /* ctor mat4x2<T : f32_f16>() -> mat4x2<T> */
+ /* ctor mat4x2<T : f32_f16>(mat4x2<T>) -> mat4x2<T> */
+ /* ctor mat4x2<T : fa_f32_f16>(T, T, T, T, T, T, T, T) -> mat4x2<T> */
+ /* ctor mat4x2<T : fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>, vec2<T>) -> mat4x2<T> */
/* conv mat4x2<T : f16>(mat4x2<f32>) -> mat4x2<f16> */
/* conv mat4x2<T : f32>(mat4x2<f16>) -> mat4x2<f32> */
/* num overloads */ 6,
@@ -15264,10 +15264,10 @@
},
{
/* [15] */
- /* init mat4x3<T : f32_f16>() -> mat4x3<T> */
- /* init mat4x3<T : f32_f16>(mat4x3<T>) -> mat4x3<T> */
- /* init mat4x3<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T) -> mat4x3<T> */
- /* init mat4x3<T : fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>, vec3<T>) -> mat4x3<T> */
+ /* ctor mat4x3<T : f32_f16>() -> mat4x3<T> */
+ /* ctor mat4x3<T : f32_f16>(mat4x3<T>) -> mat4x3<T> */
+ /* ctor mat4x3<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T) -> mat4x3<T> */
+ /* ctor mat4x3<T : fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>, vec3<T>) -> mat4x3<T> */
/* conv mat4x3<T : f16>(mat4x3<f32>) -> mat4x3<f16> */
/* conv mat4x3<T : f32>(mat4x3<f16>) -> mat4x3<f32> */
/* num overloads */ 6,
@@ -15275,10 +15275,10 @@
},
{
/* [16] */
- /* init mat4x4<T : f32_f16>() -> mat4x4<T> */
- /* init mat4x4<T : f32_f16>(mat4x4<T>) -> mat4x4<T> */
- /* init mat4x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T) -> mat4x4<T> */
- /* init mat4x4<T : fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>, vec4<T>) -> mat4x4<T> */
+ /* ctor mat4x4<T : f32_f16>() -> mat4x4<T> */
+ /* ctor mat4x4<T : f32_f16>(mat4x4<T>) -> mat4x4<T> */
+ /* ctor mat4x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T) -> mat4x4<T> */
+ /* ctor mat4x4<T : fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>, vec4<T>) -> mat4x4<T> */
/* conv mat4x4<T : f16>(mat4x4<f32>) -> mat4x4<f16> */
/* conv mat4x4<T : f32>(mat4x4<f16>) -> mat4x4<f32> */
/* num overloads */ 6,
diff --git a/src/tint/resolver/intrinsic_table.inl.tmpl b/src/tint/resolver/intrinsic_table.inl.tmpl
index db146a8..92e7e31 100644
--- a/src/tint/resolver/intrinsic_table.inl.tmpl
+++ b/src/tint/resolver/intrinsic_table.inl.tmpl
@@ -162,8 +162,8 @@
constexpr uint8_t kBinaryOperator{{ template "ExpandName" $o.Name}} = {{$i}};
{{- end }}
-constexpr IntrinsicInfo kInitializersAndConverters[] = {
-{{- range $i, $o := .InitializersAndConverters }}
+constexpr IntrinsicInfo kConstructorsAndConverters[] = {
+{{- range $i, $o := .ConstructorsAndConverters }}
{
/* [{{$i}}] */
{{- range $o.OverloadDescriptions }}
diff --git a/src/tint/resolver/intrinsic_table_test.cc b/src/tint/resolver/intrinsic_table_test.cc
index 5aee480..7f0399d 100644
--- a/src/tint/resolver/intrinsic_table_test.cc
+++ b/src/tint/resolver/intrinsic_table_test.cc
@@ -19,8 +19,8 @@
#include "gmock/gmock.h"
#include "src/tint/program_builder.h"
#include "src/tint/resolver/resolver_test_helper.h"
-#include "src/tint/sem/type_conversion.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/type/atomic.h"
#include "src/tint/type/depth_multisampled_texture.h"
#include "src/tint/type/depth_texture.h"
@@ -802,11 +802,11 @@
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicit) {
auto* i32 = create<type::I32>();
auto* vec3_i32 = create<type::Vector>(i32, 3u);
- auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{i32, i32, i32},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{i32, i32, i32},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
- EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
+ EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
ASSERT_EQ(result.target->Parameters().Length(), 3u);
EXPECT_EQ(result.target->Parameters()[0]->Type(), i32);
EXPECT_EQ(result.target->Parameters()[1]->Type(), i32);
@@ -817,11 +817,11 @@
TEST_F(IntrinsicTableTest, MatchTypeInitializerExplicit) {
auto* i32 = create<type::I32>();
auto* vec3_i32 = create<type::Vector>(i32, 3u);
- auto result = table->Lookup(InitConvIntrinsic::kVec3, i32, utils::Vector{i32, i32, i32},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{i32, i32, i32},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
- EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
+ EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
ASSERT_EQ(result.target->Parameters().Length(), 3u);
EXPECT_EQ(result.target->Parameters()[0]->Type(), i32);
EXPECT_EQ(result.target->Parameters()[1]->Type(), i32);
@@ -832,13 +832,13 @@
TEST_F(IntrinsicTableTest, MismatchTypeInitializerImplicit) {
auto* i32 = create<type::I32>();
auto* f32 = create<type::F32>();
- auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{i32, f32, i32},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{i32, f32, i32},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_EQ(result.target, nullptr);
EXPECT_EQ(Diagnostics().str(),
- R"(12:34 error: no matching initializer for vec3(i32, f32, i32)
+ R"(12:34 error: no matching constructor for vec3(i32, f32, i32)
-6 candidate initializers:
+6 candidate constructors:
vec3(x: T, y: T, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
@@ -858,13 +858,13 @@
TEST_F(IntrinsicTableTest, MismatchTypeInitializerExplicit) {
auto* i32 = create<type::I32>();
auto* f32 = create<type::F32>();
- auto result = table->Lookup(InitConvIntrinsic::kVec3, i32, utils::Vector{i32, f32, i32},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{i32, f32, i32},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_EQ(result.target, nullptr);
EXPECT_EQ(Diagnostics().str(),
- R"(12:34 error: no matching initializer for vec3<i32>(i32, f32, i32)
+ R"(12:34 error: no matching constructor for vec3<i32>(i32, f32, i32)
-6 candidate initializers:
+6 candidate constructors:
vec3(x: T, y: T, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
@@ -884,11 +884,11 @@
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicitVecFromVecAbstract) {
auto* ai = create<type::AbstractInt>();
auto* vec3_ai = create<type::Vector>(ai, 3u);
- auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{vec3_ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{vec3_ai},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->ReturnType(), vec3_ai);
- EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
+ EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
ASSERT_EQ(result.target->Parameters().Length(), 1u);
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_ai);
EXPECT_NE(result.const_eval_fn, nullptr);
@@ -900,11 +900,11 @@
auto* vec2_af = create<type::Vector>(af, 2u);
auto* mat2x2_af = create<type::Matrix>(vec2_af, 2u);
auto result =
- table->Lookup(InitConvIntrinsic::kMat2x2, nullptr, utils::Vector{vec2_ai, vec2_ai},
+ table->Lookup(CtorConvIntrinsic::kMat2x2, nullptr, utils::Vector{vec2_ai, vec2_ai},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_TYPE(result.target->ReturnType(), mat2x2_af);
- EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
+ EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
ASSERT_EQ(result.target->Parameters().Length(), 2u);
EXPECT_TYPE(result.target->Parameters()[0]->Type(), vec2_af);
EXPECT_TYPE(result.target->Parameters()[1]->Type(), vec2_af);
@@ -914,12 +914,12 @@
TEST_F(IntrinsicTableTest, MatchTypeInitializer_ConstantEval) {
auto* ai = create<type::AbstractInt>();
auto* vec3_ai = create<type::Vector>(ai, 3u);
- auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{ai, ai, ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{ai, ai, ai},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
EXPECT_EQ(result.target->ReturnType(), vec3_ai);
- EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
+ EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
ASSERT_EQ(result.target->Parameters().Length(), 3u);
EXPECT_EQ(result.target->Parameters()[0]->Type(), ai);
EXPECT_EQ(result.target->Parameters()[1]->Type(), ai);
@@ -929,14 +929,14 @@
TEST_F(IntrinsicTableTest, MatchTypeInitializer_RuntimeEval) {
auto* ai = create<type::AbstractInt>();
- auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{ai, ai, ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{ai, ai, ai},
sem::EvaluationStage::kRuntime, Source{{12, 34}});
auto* i32 = create<type::I32>();
auto* vec3_i32 = create<type::Vector>(i32, 3u);
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
- EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
+ EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
ASSERT_EQ(result.target->Parameters().Length(), 3u);
EXPECT_EQ(result.target->Parameters()[0]->Type(), i32);
EXPECT_EQ(result.target->Parameters()[1]->Type(), i32);
@@ -949,11 +949,11 @@
auto* vec3_i32 = create<type::Vector>(i32, 3u);
auto* f32 = create<type::F32>();
auto* vec3_f32 = create<type::Vector>(f32, 3u);
- auto result = table->Lookup(InitConvIntrinsic::kVec3, i32, utils::Vector{vec3_f32},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{vec3_f32},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
- EXPECT_TRUE(result.target->Is<sem::TypeConversion>());
+ EXPECT_TRUE(result.target->Is<sem::ValueConversion>());
ASSERT_EQ(result.target->Parameters().Length(), 1u);
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_f32);
}
@@ -962,13 +962,13 @@
auto* arr =
create<type::Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 4u, 4u, 4u);
auto* f32 = create<type::F32>();
- auto result = table->Lookup(InitConvIntrinsic::kVec3, f32, utils::Vector{arr},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, f32, utils::Vector{arr},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_EQ(result.target, nullptr);
EXPECT_EQ(Diagnostics().str(),
- R"(12:34 error: no matching initializer for vec3<f32>(array<u32>)
+ R"(12:34 error: no matching constructor for vec3<f32>(array<u32>)
-6 candidate initializers:
+6 candidate constructors:
vec3(vec3<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
vec3<T>() -> vec3<T> where: T is f32, f16, i32, u32 or bool
@@ -991,13 +991,13 @@
auto* vec3_ai = create<type::Vector>(ai, 3u);
auto* f32 = create<type::F32>();
auto* vec3_f32 = create<type::Vector>(f32, 3u);
- auto result = table->Lookup(InitConvIntrinsic::kVec3, af, utils::Vector{vec3_ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, af, utils::Vector{vec3_ai},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
// NOTE: Conversions are explicit, so there's no way to have it return abstracts
EXPECT_EQ(result.target->ReturnType(), vec3_f32);
- EXPECT_TRUE(result.target->Is<sem::TypeConversion>());
+ EXPECT_TRUE(result.target->Is<sem::ValueConversion>());
ASSERT_EQ(result.target->Parameters().Length(), 1u);
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_ai);
}
@@ -1008,12 +1008,12 @@
auto* vec3_ai = create<type::Vector>(ai, 3u);
auto* vec3_f32 = create<type::Vector>(create<type::F32>(), 3u);
auto* vec3_i32 = create<type::Vector>(create<type::I32>(), 3u);
- auto result = table->Lookup(InitConvIntrinsic::kVec3, af, utils::Vector{vec3_ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, af, utils::Vector{vec3_ai},
sem::EvaluationStage::kRuntime, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
EXPECT_EQ(result.target->ReturnType(), vec3_f32);
- EXPECT_TRUE(result.target->Is<sem::TypeConversion>());
+ EXPECT_TRUE(result.target->Is<sem::ValueConversion>());
ASSERT_EQ(result.target->Parameters().Length(), 1u);
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_i32);
}
@@ -1035,7 +1035,7 @@
// The first should win overload resolution.
auto* ai = create<type::AbstractInt>();
auto* i32 = create<type::I32>();
- auto result = table->Lookup(InitConvIntrinsic::kI32, nullptr, utils::Vector{ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kI32, nullptr, utils::Vector{ai},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->ReturnType(), i32);
diff --git a/src/tint/resolver/resolver.cc b/src/tint/resolver/resolver.cc
index 27f1881..7471466 100644
--- a/src/tint/resolver/resolver.cc
+++ b/src/tint/resolver/resolver.cc
@@ -60,9 +60,9 @@
#include "src/tint/sem/statement.h"
#include "src/tint/sem/struct.h"
#include "src/tint/sem/switch_statement.h"
-#include "src/tint/sem/type_conversion.h"
#include "src/tint/sem/type_expression.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/sem/variable.h"
#include "src/tint/sem/while_statement.h"
#include "src/tint/type/abstract_float.h"
@@ -1939,8 +1939,8 @@
// A CallExpression can resolve to one of:
// * A function call.
// * A builtin call.
- // * A type initializer.
- // * A type conversion.
+ // * A value constructor.
+ // * A value conversion.
auto* target = expr->target;
Mark(target);
@@ -1967,42 +1967,41 @@
bool has_side_effects =
std::any_of(args.begin(), args.end(), [](auto* e) { return e->HasSideEffects(); });
- // init_or_conv is a helper for building either a sem::TypeInitializer or
- // sem::TypeConversion call for a InitConvIntrinsic with an optional template argument type.
- auto init_or_conv = [&](InitConvIntrinsic ty, const type::Type* template_arg) -> sem::Call* {
+ // ctor_or_conv is a helper for building either a sem::ValueConstructor or
+ // sem::ValueConversion call for a CtorConvIntrinsic with an optional template argument type.
+ auto ctor_or_conv = [&](CtorConvIntrinsic ty, const type::Type* template_arg) -> sem::Call* {
auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type(); });
- auto ctor_or_conv =
- intrinsic_table_->Lookup(ty, template_arg, arg_tys, args_stage, expr->source);
- if (!ctor_or_conv.target) {
+ auto entry = intrinsic_table_->Lookup(ty, template_arg, arg_tys, args_stage, expr->source);
+ if (!entry.target) {
return nullptr;
}
- if (!MaybeMaterializeAndLoadArguments(args, ctor_or_conv.target)) {
+ if (!MaybeMaterializeAndLoadArguments(args, entry.target)) {
return nullptr;
}
const constant::Value* value = nullptr;
- auto stage = sem::EarliestStage(ctor_or_conv.target->Stage(), args_stage);
+ auto stage = sem::EarliestStage(entry.target->Stage(), args_stage);
if (stage == sem::EvaluationStage::kConstant && skip_const_eval_.Contains(expr)) {
stage = sem::EvaluationStage::kNotEvaluated;
}
if (stage == sem::EvaluationStage::kConstant) {
- auto const_args = ConvertArguments(args, ctor_or_conv.target);
+ auto const_args = ConvertArguments(args, entry.target);
if (!const_args) {
return nullptr;
}
- if (auto r = (const_eval_.*ctor_or_conv.const_eval_fn)(
- ctor_or_conv.target->ReturnType(), const_args.Get(), expr->source)) {
+ if (auto r = (const_eval_.*entry.const_eval_fn)(entry.target->ReturnType(),
+ const_args.Get(), expr->source)) {
value = r.Get();
} else {
return nullptr;
}
}
- return builder_->create<sem::Call>(expr, ctor_or_conv.target, stage, std::move(args),
+ return builder_->create<sem::Call>(expr, entry.target, stage, std::move(args),
current_statement_, value, has_side_effects);
};
- // arr_or_str_init is a helper for building a sem::TypeInitializer for an array or structure
- // initializer call target.
+ // arr_or_str_init is a helper for building a sem::ValueConstructor for an array or structure
+ // constructor call target.
auto arr_or_str_init = [&](const type::Type* ty,
const sem::CallTarget* call_target) -> sem::Call* {
if (!MaybeMaterializeAndLoadArguments(args, call_target)) {
@@ -2012,7 +2011,7 @@
auto stage = args_stage; // The evaluation stage of the call
const constant::Value* value = nullptr; // The constant value for the call
if (stage == sem::EvaluationStage::kConstant) {
- if (auto r = const_eval_.ArrayOrStructInit(ty, args)) {
+ if (auto r = const_eval_.ArrayOrStructCtor(ty, args)) {
value = r.Get();
} else {
return nullptr;
@@ -2021,7 +2020,7 @@
// Constant evaluation failed.
// Can happen for expressions that will fail validation (later).
// Use the kRuntime EvaluationStage, as kConstant will trigger an assertion in
- // the sem::ValueExpression initializer, which checks that kConstant is paired
+ // the sem::ValueExpression constructor, which checks that kConstant is paired
// with a constant value.
stage = sem::EvaluationStage::kRuntime;
}
@@ -2034,25 +2033,25 @@
auto ty_init_or_conv = [&](const type::Type* type) {
return Switch(
type, //
- [&](const type::I32*) { return init_or_conv(InitConvIntrinsic::kI32, nullptr); },
- [&](const type::U32*) { return init_or_conv(InitConvIntrinsic::kU32, nullptr); },
+ [&](const type::I32*) { return ctor_or_conv(CtorConvIntrinsic::kI32, nullptr); },
+ [&](const type::U32*) { return ctor_or_conv(CtorConvIntrinsic::kU32, nullptr); },
[&](const type::F16*) {
return validator_.CheckF16Enabled(expr->source)
- ? init_or_conv(InitConvIntrinsic::kF16, nullptr)
+ ? ctor_or_conv(CtorConvIntrinsic::kF16, nullptr)
: nullptr;
},
- [&](const type::F32*) { return init_or_conv(InitConvIntrinsic::kF32, nullptr); },
- [&](const type::Bool*) { return init_or_conv(InitConvIntrinsic::kBool, nullptr); },
+ [&](const type::F32*) { return ctor_or_conv(CtorConvIntrinsic::kF32, nullptr); },
+ [&](const type::Bool*) { return ctor_or_conv(CtorConvIntrinsic::kBool, nullptr); },
[&](const type::Vector* v) {
- return init_or_conv(VectorInitConvIntrinsic(v->Width()), v->type());
+ return ctor_or_conv(VectorCtorConvIntrinsic(v->Width()), v->type());
},
[&](const type::Matrix* m) {
- return init_or_conv(MatrixInitConvIntrinsic(m->columns(), m->rows()), m->type());
+ return ctor_or_conv(MatrixCtorConvIntrinsic(m->columns(), m->rows()), m->type());
},
[&](const type::Array* arr) -> sem::Call* {
- auto* call_target = array_inits_.GetOrCreate(
- ArrayInitializerSig{{arr, args.Length(), args_stage}},
- [&]() -> sem::TypeInitializer* {
+ auto* call_target = array_ctors_.GetOrCreate(
+ ArrayConstructorSig{{arr, args.Length(), args_stage}},
+ [&]() -> sem::ValueConstructor* {
auto params = utils::Transform(args, [&](auto, size_t i) {
return builder_->create<sem::Parameter>(
nullptr, // declaration
@@ -2061,8 +2060,8 @@
builtin::AddressSpace::kUndefined, // address_space
builtin::Access::kUndefined);
});
- return builder_->create<sem::TypeInitializer>(arr, std::move(params),
- args_stage);
+ return builder_->create<sem::ValueConstructor>(arr, std::move(params),
+ args_stage);
});
auto* call = arr_or_str_init(arr, call_target);
@@ -2071,15 +2070,15 @@
}
// Validation must occur after argument materialization in arr_or_str_init().
- if (!validator_.ArrayInitializer(expr, arr)) {
+ if (!validator_.ArrayConstructor(expr, arr)) {
return nullptr;
}
return call;
},
[&](const sem::Struct* str) -> sem::Call* {
- auto* call_target = struct_inits_.GetOrCreate(
- StructInitializerSig{{str, args.Length(), args_stage}},
- [&]() -> sem::TypeInitializer* {
+ auto* call_target = struct_ctors_.GetOrCreate(
+ StructConstructorSig{{str, args.Length(), args_stage}},
+ [&]() -> sem::ValueConstructor* {
utils::Vector<const sem::Parameter*, 8> params;
params.Resize(std::min(args.Length(), str->Members().Length()));
for (size_t i = 0, n = params.Length(); i < n; i++) {
@@ -2090,8 +2089,8 @@
builtin::AddressSpace::kUndefined, // address_space
builtin::Access::kUndefined); // access
}
- return builder_->create<sem::TypeInitializer>(str, std::move(params),
- args_stage);
+ return builder_->create<sem::ValueConstructor>(str, std::move(params),
+ args_stage);
});
auto* call = arr_or_str_init(str, call_target);
@@ -2117,7 +2116,7 @@
auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type()->UnwrapRef(); });
auto el_ty = type::Type::Common(arg_tys);
if (!el_ty) {
- AddError("cannot infer common array element type from initializer arguments",
+ AddError("cannot infer common array element type from constructor arguments",
expr->source);
utils::Hashset<const type::Type*, 8> types;
for (size_t i = 0; i < args.Length(); i++) {
@@ -2172,29 +2171,29 @@
case builtin::Builtin::kArray:
return inferred_array();
case builtin::Builtin::kVec2:
- return init_or_conv(InitConvIntrinsic::kVec2, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kVec2, nullptr);
case builtin::Builtin::kVec3:
- return init_or_conv(InitConvIntrinsic::kVec3, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kVec3, nullptr);
case builtin::Builtin::kVec4:
- return init_or_conv(InitConvIntrinsic::kVec4, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kVec4, nullptr);
case builtin::Builtin::kMat2X2:
- return init_or_conv(InitConvIntrinsic::kMat2x2, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kMat2x2, nullptr);
case builtin::Builtin::kMat2X3:
- return init_or_conv(InitConvIntrinsic::kMat2x3, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kMat2x3, nullptr);
case builtin::Builtin::kMat2X4:
- return init_or_conv(InitConvIntrinsic::kMat2x4, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kMat2x4, nullptr);
case builtin::Builtin::kMat3X2:
- return init_or_conv(InitConvIntrinsic::kMat3x2, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kMat3x2, nullptr);
case builtin::Builtin::kMat3X3:
- return init_or_conv(InitConvIntrinsic::kMat3x3, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kMat3x3, nullptr);
case builtin::Builtin::kMat3X4:
- return init_or_conv(InitConvIntrinsic::kMat3x4, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kMat3x4, nullptr);
case builtin::Builtin::kMat4X2:
- return init_or_conv(InitConvIntrinsic::kMat4x2, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kMat4x2, nullptr);
case builtin::Builtin::kMat4X3:
- return init_or_conv(InitConvIntrinsic::kMat4x3, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kMat4x3, nullptr);
case builtin::Builtin::kMat4X4:
- return init_or_conv(InitConvIntrinsic::kMat4x4, nullptr);
+ return ctor_or_conv(CtorConvIntrinsic::kMat4x4, nullptr);
default:
break;
}
@@ -2219,7 +2218,7 @@
return nullptr;
}
- if (call->Target()->IsAnyOf<sem::TypeInitializer, sem::TypeConversion>()) {
+ if (call->Target()->IsAnyOf<sem::ValueConstructor, sem::ValueConversion>()) {
// The target of the call was a type.
// Associate the target identifier expression with the resolved type.
auto* ty_expr =
diff --git a/src/tint/resolver/resolver.h b/src/tint/resolver/resolver.h
index c29a416..72f9e8f 100644
--- a/src/tint/resolver/resolver.h
+++ b/src/tint/resolver/resolver.h
@@ -67,7 +67,6 @@
class Statement;
class StructMember;
class SwitchStatement;
-class TypeInitializer;
class WhileStatement;
} // namespace tint::sem
namespace tint::type {
@@ -497,15 +496,15 @@
/// @note: Will raise an ICE if @p symbol is not a builtin type.
type::Type* BuiltinType(builtin::Builtin builtin_ty, const ast::Identifier* ident);
- // ArrayInitializerSig represents a unique array initializer signature.
+ // ArrayConstructorSig represents a unique array constructor signature.
// It is a tuple of the array type, number of arguments provided and earliest evaluation stage.
- using ArrayInitializerSig =
+ using ArrayConstructorSig =
utils::UnorderedKeyWrapper<std::tuple<const type::Array*, size_t, sem::EvaluationStage>>;
- // StructInitializerSig represents a unique structure initializer signature.
+ // StructConstructorSig represents a unique structure constructor signature.
// It is a tuple of the structure type, number of arguments provided and earliest evaluation
// stage.
- using StructInitializerSig =
+ using StructConstructorSig =
utils::UnorderedKeyWrapper<std::tuple<const sem::Struct*, size_t, sem::EvaluationStage>>;
/// ExprEvalStageConstraint describes a constraint on when expressions can be evaluated.
@@ -555,8 +554,8 @@
ExprEvalStageConstraint expr_eval_stage_constraint_;
std::unordered_map<const sem::Function*, AliasAnalysisInfo> alias_analysis_infos_;
utils::Hashmap<OverrideId, const sem::Variable*, 8> override_ids_;
- utils::Hashmap<ArrayInitializerSig, sem::CallTarget*, 8> array_inits_;
- utils::Hashmap<StructInitializerSig, sem::CallTarget*, 8> struct_inits_;
+ utils::Hashmap<ArrayConstructorSig, sem::CallTarget*, 8> array_ctors_;
+ utils::Hashmap<StructConstructorSig, sem::CallTarget*, 8> struct_ctors_;
sem::Function* current_function_ = nullptr;
sem::Statement* current_statement_ = nullptr;
sem::CompoundStatement* current_compound_statement_ = nullptr;
diff --git a/src/tint/resolver/sem_helper.cc b/src/tint/resolver/sem_helper.cc
index 0a9bc1b..d11d790 100644
--- a/src/tint/resolver/sem_helper.cc
+++ b/src/tint/resolver/sem_helper.cc
@@ -114,7 +114,7 @@
ErrorUnexpectedExprKind(expr, "value");
if (auto* ty_expr = expr->As<sem::TypeExpression>()) {
if (auto* ident = ty_expr->Declaration()->As<ast::IdentifierExpression>()) {
- AddNote("are you missing '()' for type initializer?",
+ AddNote("are you missing '()' for value constructor?",
Source{{ident->source.range.end}});
}
if (auto* str = ty_expr->Type()->As<type::Struct>()) {
diff --git a/src/tint/resolver/uniformity.cc b/src/tint/resolver/uniformity.cc
index d02be8d..37fba4c 100644
--- a/src/tint/resolver/uniformity.cc
+++ b/src/tint/resolver/uniformity.cc
@@ -34,8 +34,8 @@
#include "src/tint/sem/loop_statement.h"
#include "src/tint/sem/statement.h"
#include "src/tint/sem/switch_statement.h"
-#include "src/tint/sem/type_conversion.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/sem/variable.h"
#include "src/tint/sem/while_statement.h"
#include "src/tint/utils/block_allocator.h"
@@ -1541,11 +1541,11 @@
function_tag = info->function_tag;
func_info = info;
},
- [&](const sem::TypeInitializer*) {
+ [&](const sem::ValueConstructor*) {
callsite_tag = {CallSiteTag::CallSiteNoRestriction};
function_tag = NoRestriction;
},
- [&](const sem::TypeConversion*) {
+ [&](const sem::ValueConversion*) {
callsite_tag = {CallSiteTag::CallSiteNoRestriction};
function_tag = NoRestriction;
},
@@ -1631,7 +1631,7 @@
current_function_->RequiredToBeUniform(default_severity)->AddEdge(args[i]);
} else {
// All other builtin function parameters are RequiredToBeUniformForReturnValue,
- // as are parameters for type initializers and type conversions.
+ // as are parameters for value constructors and value conversions.
result->AddEdge(args[i]);
}
}
diff --git a/src/tint/resolver/validator.cc b/src/tint/resolver/validator.cc
index cedd5bf..4875022 100644
--- a/src/tint/resolver/validator.cc
+++ b/src/tint/resolver/validator.cc
@@ -49,8 +49,8 @@
#include "src/tint/sem/statement.h"
#include "src/tint/sem/struct.h"
#include "src/tint/sem/switch_statement.h"
-#include "src/tint/sem/type_conversion.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/sem/variable.h"
#include "src/tint/sem/while_statement.h"
#include "src/tint/type/abstract_numeric.h"
@@ -1507,11 +1507,11 @@
AddError("ignoring return value of builtin '" + utils::ToString(b->Type()) + "'",
call->Declaration()->source);
},
- [&](const sem::TypeConversion*) {
- AddError("type conversion evaluated but not used", call->Declaration()->source);
+ [&](const sem::ValueConversion*) {
+ AddError("value conversion evaluated but not used", call->Declaration()->source);
},
- [&](const sem::TypeInitializer*) {
- AddError("type initializer evaluated but not used", call->Declaration()->source);
+ [&](const sem::ValueConstructor*) {
+ AddError("value constructor evaluated but not used", call->Declaration()->source);
},
[&](Default) {
AddError("return value of call not used", call->Declaration()->source);
@@ -1825,14 +1825,14 @@
bool Validator::StructureInitializer(const ast::CallExpression* ctor,
const sem::Struct* struct_type) const {
if (!struct_type->IsConstructible()) {
- AddError("struct initializer has non-constructible type", ctor->source);
+ AddError("structure constructor has non-constructible type", ctor->source);
return false;
}
if (ctor->args.Length() > 0) {
if (ctor->args.Length() != struct_type->Members().Length()) {
std::string fm = ctor->args.Length() < struct_type->Members().Length() ? "few" : "many";
- AddError("struct initializer has too " + fm + " inputs: expected " +
+ AddError("structure constructor has too " + fm + " inputs: expected " +
std::to_string(struct_type->Members().Length()) + ", found " +
std::to_string(ctor->args.Length()),
ctor->source);
@@ -1843,7 +1843,7 @@
auto* value_ty = sem_.TypeOf(value);
if (member->Type() != value_ty->UnwrapRef()) {
AddError(
- "type in struct initializer does not match struct member type: expected '" +
+ "type in structure constructor does not match struct member type: expected '" +
sem_.TypeNameOf(member->Type()) + "', found '" + sem_.TypeNameOf(value_ty) +
"'",
value->source);
@@ -1854,7 +1854,7 @@
return true;
}
-bool Validator::ArrayInitializer(const ast::CallExpression* ctor,
+bool Validator::ArrayConstructor(const ast::CallExpression* ctor,
const type::Array* array_type) const {
auto& values = ctor->args;
auto* elem_ty = array_type->ElemType();
@@ -1881,7 +1881,7 @@
}
if (!elem_ty->IsConstructible()) {
- AddError("array initializer has non-constructible element type", ctor->source);
+ AddError("array constructor has non-constructible element type", ctor->source);
return false;
}
@@ -1893,7 +1893,7 @@
const auto count = c->As<type::ConstantArrayCount>()->value;
if (!values.IsEmpty() && (values.Length() != count)) {
std::string fm = values.Length() < count ? "few" : "many";
- AddError("array initializer has too " + fm + " elements: expected " +
+ AddError("array constructor has too " + fm + " elements: expected " +
std::to_string(count) + ", found " + std::to_string(values.Length()),
ctor->source);
return false;
diff --git a/src/tint/resolver/validator.h b/src/tint/resolver/validator.h
index 3128ae1..45c98c8 100644
--- a/src/tint/resolver/validator.h
+++ b/src/tint/resolver/validator.h
@@ -61,7 +61,6 @@
class Materialize;
class Statement;
class SwitchStatement;
-class TypeInitializer;
class WhileStatement;
} // namespace tint::sem
namespace tint::type {
@@ -445,11 +444,11 @@
/// @returns true on success, false otherwise
bool Vector(const type::Type* el_ty, const Source& source) const;
- /// Validates an array initializer
+ /// Validates an array constructor
/// @param ctor the call expresion to validate
/// @param arr_type the type of the array
/// @returns true on success, false otherwise
- bool ArrayInitializer(const ast::CallExpression* ctor, const type::Array* arr_type) const;
+ bool ArrayConstructor(const ast::CallExpression* ctor, const type::Array* arr_type) const;
/// Validates a texture builtin function
/// @param call the builtin call to validate
diff --git a/src/tint/resolver/type_initializer_validation_test.cc b/src/tint/resolver/value_constructor_validation_test.cc
similarity index 81%
rename from src/tint/resolver/type_initializer_validation_test.cc
rename to src/tint/resolver/value_constructor_validation_test.cc
index 10d6ae4..8ab1cab 100644
--- a/src/tint/resolver/type_initializer_validation_test.cc
+++ b/src/tint/resolver/value_constructor_validation_test.cc
@@ -14,8 +14,8 @@
#include "gmock/gmock.h"
#include "src/tint/resolver/resolver_test_helper.h"
-#include "src/tint/sem/type_conversion.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/type/reference.h"
using namespace tint::number_suffixes; // NOLINT
@@ -42,7 +42,7 @@
using builder::vec3;
using builder::vec4;
-class ResolverTypeInitializerValidationTest : public resolver::TestHelper, public testing::Test {};
+class ResolverValueConstructorValidationTest : public resolver::TestHelper, public testing::Test {};
namespace InferTypeTest {
struct Params {
@@ -56,7 +56,7 @@
return Params{DataType<T>::AST, DataType<T>::ExprFromDouble, DataType<T>::Sem};
}
-TEST_F(ResolverTypeInitializerValidationTest, InferTypeTest_Simple) {
+TEST_F(ResolverValueConstructorValidationTest, InferTypeTest_Simple) {
// var a = 1i;
// var b = a;
auto* a = Var("a", Expr(1_i));
@@ -77,8 +77,8 @@
builtin::AddressSpace::kFunction);
}
-using InferTypeTest_FromInitializerExpression = ResolverTestWithParam<Params>;
-TEST_P(InferTypeTest_FromInitializerExpression, All) {
+using InferTypeTest_FromConstructorExpression = ResolverTestWithParam<Params>;
+TEST_P(InferTypeTest_FromConstructorExpression, All) {
// e.g. for vec3<f32>
// {
// var a = vec3<f32>(0.0, 0.0, 0.0)
@@ -104,7 +104,7 @@
<< "expected: " << FriendlyName(expected) << "\n";
}
-static constexpr Params from_initializer_expression_cases[] = {
+static constexpr Params from_constructor_expression_cases[] = {
ParamsFor<bool>(),
ParamsFor<i32>(),
ParamsFor<u32>(),
@@ -128,9 +128,9 @@
ParamsFor<alias<mat3x3<f32>>>(),
ParamsFor<alias<mat3x3<f16>>>(),
};
-INSTANTIATE_TEST_SUITE_P(ResolverTypeInitializerValidationTest,
- InferTypeTest_FromInitializerExpression,
- testing::ValuesIn(from_initializer_expression_cases));
+INSTANTIATE_TEST_SUITE_P(ResolverValueConstructorValidationTest,
+ InferTypeTest_FromConstructorExpression,
+ testing::ValuesIn(from_constructor_expression_cases));
using InferTypeTest_FromArithmeticExpression = ResolverTestWithParam<Params>;
TEST_P(InferTypeTest_FromArithmeticExpression, All) {
@@ -170,7 +170,7 @@
ParamsFor<alias<vec3<f32>>>(),
ParamsFor<alias<mat3x3<f32>>>(),
};
-INSTANTIATE_TEST_SUITE_P(ResolverTypeInitializerValidationTest,
+INSTANTIATE_TEST_SUITE_P(ResolverValueConstructorValidationTest,
InferTypeTest_FromArithmeticExpression,
testing::ValuesIn(from_arithmetic_expression_cases));
@@ -231,7 +231,7 @@
ParamsFor<alias<mat3x3<f32>>>(),
ParamsFor<alias<mat3x3<f16>>>(),
};
-INSTANTIATE_TEST_SUITE_P(ResolverTypeInitializerValidationTest,
+INSTANTIATE_TEST_SUITE_P(ResolverValueConstructorValidationTest,
InferTypeTest_FromCallExpression,
testing::ValuesIn(from_call_expression_cases));
@@ -342,8 +342,8 @@
ParamsFor<mat3x2<f32>, mat3x2<f16>>(Kind::Conversion), //
};
-using ConversionInitializerValidTest = ResolverTestWithParam<Params>;
-TEST_P(ConversionInitializerValidTest, All) {
+using ConversionConstructorValidTest = ResolverTestWithParam<Params>;
+TEST_P(ConversionConstructorValidTest, All) {
auto& params = GetParam();
Enable(builtin::Extension::kF16);
@@ -374,7 +374,7 @@
ASSERT_NE(call, nullptr);
switch (params.kind) {
case Kind::Construct: {
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
@@ -382,7 +382,7 @@
break;
}
case Kind::Conversion: {
- auto* conv = call->Target()->As<sem::TypeConversion>();
+ auto* conv = call->Target()->As<sem::ValueConversion>();
ASSERT_NE(conv, nullptr);
EXPECT_EQ(call->Type(), conv->ReturnType());
ASSERT_EQ(conv->Parameters().Length(), 1u);
@@ -391,8 +391,8 @@
}
}
}
-INSTANTIATE_TEST_SUITE_P(ResolverTypeInitializerValidationTest,
- ConversionInitializerValidTest,
+INSTANTIATE_TEST_SUITE_P(ResolverValueConstructorValidationTest,
+ ConversionConstructorValidTest,
testing::ValuesIn(valid_cases));
constexpr CreatePtrs all_types[] = {
@@ -420,10 +420,10 @@
CreatePtrsFor<mat3x2<f16>>(), //
};
-using ConversionInitializerInvalidTest = ResolverTestWithParam<std::tuple<CreatePtrs, // lhs
+using ConversionConstructorInvalidTest = ResolverTestWithParam<std::tuple<CreatePtrs, // lhs
CreatePtrs // rhs
>>;
-TEST_P(ConversionInitializerInvalidTest, All) {
+TEST_P(ConversionConstructorInvalidTest, All) {
auto& params = GetParam();
auto& lhs_params = std::get<0>(params);
@@ -463,33 +463,33 @@
ASSERT_FALSE(r()->Resolve());
}
-INSTANTIATE_TEST_SUITE_P(ResolverTypeInitializerValidationTest,
- ConversionInitializerInvalidTest,
+INSTANTIATE_TEST_SUITE_P(ResolverValueConstructorValidationTest,
+ ConversionConstructorInvalidTest,
testing::Combine(testing::ValuesIn(all_types),
testing::ValuesIn(all_types)));
-TEST_F(ResolverTypeInitializerValidationTest, ConversionInitializerInvalid_TooManyInitializers) {
+TEST_F(ResolverValueConstructorValidationTest, ConversionConstructorInvalid_TooManyConstructors) {
auto* a = Var("a", ty.f32(), Call(Source{{12, 34}}, ty.f32(), Expr(1_f), Expr(2_f)));
WrapInFunction(a);
ASSERT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for f32(f32, f32)"));
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for f32(f32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, ConversionInitializerInvalid_InvalidInitializer) {
+TEST_F(ResolverValueConstructorValidationTest, ConversionConstructorInvalid_InvalidConstructor) {
auto* a = Var("a", ty.f32(), Call(Source{{12, 34}}, ty.f32(), Call(ty.array<f32, 4>())));
WrapInFunction(a);
ASSERT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for f32(array<f32, 4>)"));
+ HasSubstr("12:34 error: no matching constructor for f32(array<f32, 4>)"));
}
} // namespace ConversionConstructTest
-namespace ArrayInitializer {
+namespace ArrayConstructor {
-TEST_F(ResolverTypeInitializerValidationTest, Array_ZeroValue_Pass) {
+TEST_F(ResolverValueConstructorValidationTest, Array_ZeroValue_Pass) {
// array<u32, 10u>();
auto* tc = array<u32, 10>();
WrapInFunction(tc);
@@ -499,13 +499,13 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
EXPECT_TRUE(call->Type()->Is<type::Array>());
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 0u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Array_U32U32U32) {
+TEST_F(ResolverValueConstructorValidationTest, Array_U32U32U32) {
// array<u32, 3u>(0u, 10u, 20u);
auto* tc = array<u32, 3>(0_u, 10_u, 20_u);
WrapInFunction(tc);
@@ -515,7 +515,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
EXPECT_TRUE(call->Type()->Is<type::Array>());
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -524,7 +524,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::U32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArray_U32U32U32) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArray_U32U32U32) {
// array(0u, 10u, 20u);
auto* tc = array<Infer>(Source{{12, 34}}, 0_u, 10_u, 20_u);
WrapInFunction(tc);
@@ -534,7 +534,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
EXPECT_TRUE(call->Type()->Is<type::Array>());
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -543,7 +543,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::U32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Array_U32AIU32) {
+TEST_F(ResolverValueConstructorValidationTest, Array_U32AIU32) {
// array<u32, 3u>(0u, 10, 20u);
auto* tc = array<u32, 3>(0_u, 10_a, 20_u);
WrapInFunction(tc);
@@ -553,7 +553,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
EXPECT_TRUE(call->Type()->Is<type::Array>());
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -562,7 +562,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::U32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArray_U32AIU32) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArray_U32AIU32) {
// array(0u, 10u, 20u);
auto* tc = array<Infer>(Source{{12, 34}}, 0_u, 10_a, 20_u);
WrapInFunction(tc);
@@ -572,7 +572,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
EXPECT_TRUE(call->Type()->Is<type::Array>());
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -581,7 +581,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::U32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, ArrayU32_AIAIAI) {
+TEST_F(ResolverValueConstructorValidationTest, ArrayU32_AIAIAI) {
// array<u32, 3u>(0, 10, 20);
auto* tc = array<u32, 3>(0_a, 10_a, 20_a);
WrapInFunction(tc);
@@ -591,7 +591,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
EXPECT_TRUE(call->Type()->Is<type::Array>());
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -600,7 +600,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::U32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArray_AIAIAI) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArray_AIAIAI) {
// const c = array(0, 10, 20);
auto* tc = array<Infer>(Source{{12, 34}}, 0_a, 10_a, 20_a);
WrapInFunction(Decl(Const("C", tc)));
@@ -610,7 +610,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
EXPECT_TRUE(call->Type()->Is<type::Array>());
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -619,7 +619,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::AbstractInt>());
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayU32_VecI32_VecAI) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayU32_VecI32_VecAI) {
// array(vec2(10i), vec2(20));
auto* tc = array<Infer>(Source{{12, 34}}, //
Call(ty.vec<Infer>(2), 20_i), //
@@ -631,7 +631,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
EXPECT_TRUE(call->Type()->Is<type::Array>());
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 2u);
@@ -641,7 +641,7 @@
EXPECT_TRUE(ctor->Parameters()[1]->Type()->As<type::Vector>()->type()->Is<type::I32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayU32_VecAI_VecF32) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayU32_VecAI_VecF32) {
// array(vec2(20), vec2(10f));
auto* tc = array<Infer>(Source{{12, 34}}, //
Call(ty.vec<Infer>(2), 20_a), //
@@ -653,7 +653,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
EXPECT_TRUE(call->Type()->Is<type::Array>());
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 2u);
@@ -663,7 +663,7 @@
EXPECT_TRUE(ctor->Parameters()[1]->Type()->As<type::Vector>()->type()->Is<type::F32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, ArrayArgumentTypeMismatch_U32F32) {
+TEST_F(ResolverValueConstructorValidationTest, ArrayArgumentTypeMismatch_U32F32) {
// array<u32, 3u>(0u, 1.0f, 20u);
auto* tc = array<u32, 3>(0_u, Expr(Source{{12, 34}}, 1_f), 20_u);
WrapInFunction(tc);
@@ -672,19 +672,19 @@
EXPECT_EQ(r()->error(), R"(12:34 error: 'f32' cannot be used to construct an array of 'u32')");
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayArgumentTypeMismatch_U32F32) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayArgumentTypeMismatch_U32F32) {
// array(0u, 1.0f, 20u);
auto* tc = array<Infer>(Source{{12, 34}}, 0_u, 1_f, 20_u);
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: cannot infer common array element type from initializer arguments
+ R"(12:34 error: cannot infer common array element type from constructor arguments
note: argument 0 is of type 'u32'
note: argument 1 is of type 'f32')");
}
-TEST_F(ResolverTypeInitializerValidationTest, ArrayArgumentTypeMismatch_F32I32) {
+TEST_F(ResolverValueConstructorValidationTest, ArrayArgumentTypeMismatch_F32I32) {
// array<f32, 1u>(1i);
auto* tc = array<f32, 1>(Expr(Source{{12, 34}}, 1_i));
WrapInFunction(tc);
@@ -693,19 +693,19 @@
EXPECT_EQ(r()->error(), R"(12:34 error: 'i32' cannot be used to construct an array of 'f32')");
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayArgumentTypeMismatch_F32I32) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayArgumentTypeMismatch_F32I32) {
// array(1f, 1i);
auto* tc = array<Infer>(Source{{12, 34}}, 1_f, 1_i);
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: cannot infer common array element type from initializer arguments
+ R"(12:34 error: cannot infer common array element type from constructor arguments
note: argument 0 is of type 'f32'
note: argument 1 is of type 'i32')");
}
-TEST_F(ResolverTypeInitializerValidationTest, ArrayArgumentTypeMismatch_U32I32) {
+TEST_F(ResolverValueConstructorValidationTest, ArrayArgumentTypeMismatch_U32I32) {
// array<u32, 1u>(1i, 0u, 0u, 0u, 0u, 0u);
auto* tc = array<u32, 1>(Expr(Source{{12, 34}}, 1_i), 0_u, 0_u, 0_u, 0_u);
WrapInFunction(tc);
@@ -714,19 +714,19 @@
EXPECT_EQ(r()->error(), R"(12:34 error: 'i32' cannot be used to construct an array of 'u32')");
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayArgumentTypeMismatch_U32I32) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayArgumentTypeMismatch_U32I32) {
// array(1i, 0u, 0u, 0u, 0u, 0u);
auto* tc = array<Infer>(Source{{12, 34}}, 1_i, 0_u, 0_u, 0_u, 0_u);
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: cannot infer common array element type from initializer arguments
+ R"(12:34 error: cannot infer common array element type from constructor arguments
note: argument 0 is of type 'i32'
note: argument 1 is of type 'u32')");
}
-TEST_F(ResolverTypeInitializerValidationTest, ArrayArgumentTypeMismatch_I32Vec2) {
+TEST_F(ResolverValueConstructorValidationTest, ArrayArgumentTypeMismatch_I32Vec2) {
// array<i32, 3u>(1i, vec2<i32>());
auto* tc = array<i32, 3>(1_i, vec2<i32>(Source{{12, 34}}));
WrapInFunction(tc);
@@ -735,18 +735,18 @@
R"(12:34 error: 'vec2<i32>' cannot be used to construct an array of 'i32')");
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayArgumentTypeMismatch_I32Vec2) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayArgumentTypeMismatch_I32Vec2) {
// array(1i, vec2<i32>());
auto* tc = array<Infer>(Source{{12, 34}}, 1_i, vec2<i32>());
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: cannot infer common array element type from initializer arguments
+ R"(12:34 error: cannot infer common array element type from constructor arguments
note: argument 0 is of type 'i32'
note: argument 1 is of type 'vec2<i32>')");
}
-TEST_F(ResolverTypeInitializerValidationTest, ArrayArgumentTypeMismatch_Vec3i32_Vec3u32) {
+TEST_F(ResolverValueConstructorValidationTest, ArrayArgumentTypeMismatch_Vec3i32_Vec3u32) {
// array<vec3<i32>, 2u>(vec3<u32>(), vec3<u32>());
auto* t = array(ty.vec3<i32>(), 2_u, vec3<u32>(Source{{12, 34}}), vec3<u32>());
WrapInFunction(t);
@@ -756,31 +756,31 @@
R"(12:34 error: 'vec3<u32>' cannot be used to construct an array of 'vec3<i32>')");
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayArgumentTypeMismatch_Vec3i32_Vec3u32) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayArgumentTypeMismatch_Vec3i32_Vec3u32) {
// array(vec3<i32>(), vec3<u32>());
auto* t = array<Infer>(Source{{12, 34}}, vec3<i32>(), vec3<u32>());
WrapInFunction(t);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: cannot infer common array element type from initializer arguments
+ R"(12:34 error: cannot infer common array element type from constructor arguments
note: argument 0 is of type 'vec3<i32>'
note: argument 1 is of type 'vec3<u32>')");
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayArgumentTypeMismatch_Vec3i32_Vec3AF) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayArgumentTypeMismatch_Vec3i32_Vec3AF) {
// array(vec3<i32>(), vec3(1.0));
auto* t = array<Infer>(Source{{12, 34}}, vec3<i32>(), Call("vec3", 1._a));
WrapInFunction(t);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: cannot infer common array element type from initializer arguments
+ R"(12:34 error: cannot infer common array element type from constructor arguments
note: argument 0 is of type 'vec3<i32>'
note: argument 1 is of type 'vec3<abstract-float>')");
}
-TEST_F(ResolverTypeInitializerValidationTest, ArrayArgumentTypeMismatch_Vec3i32_Vec3bool) {
+TEST_F(ResolverValueConstructorValidationTest, ArrayArgumentTypeMismatch_Vec3i32_Vec3bool) {
// array<vec3<i32>, 2u>(vec3<i32>(), vec3<bool>());
auto* t = array(ty.vec3<i32>(), 2_u, vec3<i32>(), vec3<bool>());
WrapInFunction(t);
@@ -790,19 +790,19 @@
R"(error: 'vec3<bool>' cannot be used to construct an array of 'vec3<i32>')");
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayArgumentTypeMismatch_Vec3i32_Vec3bool) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayArgumentTypeMismatch_Vec3i32_Vec3bool) {
// array(vec3<i32>(), vec3<bool>());
auto* t = array<Infer>(Source{{12, 34}}, vec3<i32>(), vec3<bool>());
WrapInFunction(t);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: cannot infer common array element type from initializer arguments
+ R"(12:34 error: cannot infer common array element type from constructor arguments
note: argument 0 is of type 'vec3<i32>'
note: argument 1 is of type 'vec3<bool>')");
}
-TEST_F(ResolverTypeInitializerValidationTest, ArrayOfArray_SubElemSizeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, ArrayOfArray_SubElemSizeMismatch) {
// array<array<i32, 2u>, 2u>(array<i32, 3u>(), array<i32, 2u>());
auto* t = array(Source{{12, 34}}, ty.array<i32, 2>(), 2_i, array<i32, 3>(), array<i32, 2>());
WrapInFunction(t);
@@ -812,19 +812,19 @@
R"(error: 'array<i32, 3>' cannot be used to construct an array of 'array<i32, 2>')");
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayOfArray_SubElemSizeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayOfArray_SubElemSizeMismatch) {
// array<array<i32, 2u>, 2u>(array<i32, 3u>(), array<i32, 2u>());
auto* t = array<Infer>(Source{{12, 34}}, array<i32, 3>(), array<i32, 2>());
WrapInFunction(t);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: cannot infer common array element type from initializer arguments
+ R"(12:34 error: cannot infer common array element type from constructor arguments
note: argument 0 is of type 'array<i32, 3>'
note: argument 1 is of type 'array<i32, 2>')");
}
-TEST_F(ResolverTypeInitializerValidationTest, ArrayOfArray_SubElemTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, ArrayOfArray_SubElemTypeMismatch) {
// array<array<i32, 2u>, 2u>(array<i32, 2u>(), array<u32, 2u>());
auto* t = array(Source{{12, 34}}, ty.array<i32, 2>(), 2_i, array<i32, 2>(), array<u32, 2>());
WrapInFunction(t);
@@ -834,19 +834,19 @@
R"(error: 'array<u32, 2>' cannot be used to construct an array of 'array<i32, 2>')");
}
-TEST_F(ResolverTypeInitializerValidationTest, InferredArrayOfArray_SubElemTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, InferredArrayOfArray_SubElemTypeMismatch) {
// array<array<i32, 2u>, 2u>(array<i32, 2u>(), array<u32, 2u>());
auto* t = array<Infer>(Source{{12, 34}}, array<i32, 2>(), array<u32, 2>());
WrapInFunction(t);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- R"(12:34 error: cannot infer common array element type from initializer arguments
+ R"(12:34 error: cannot infer common array element type from constructor arguments
note: argument 0 is of type 'array<i32, 2>'
note: argument 1 is of type 'array<u32, 2>')");
}
-TEST_F(ResolverTypeInitializerValidationTest, Array_TooFewElements) {
+TEST_F(ResolverValueConstructorValidationTest, Array_TooFewElements) {
// array<i32, 4u>(1i, 2i, 3i);
SetSource(Source::Location({12, 34}));
auto* tc = array<i32, 4>(Expr(1_i), Expr(2_i), Expr(3_i));
@@ -854,10 +854,10 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- "12:34 error: array initializer has too few elements: expected 4, found 3");
+ "12:34 error: array constructor has too few elements: expected 4, found 3");
}
-TEST_F(ResolverTypeInitializerValidationTest, Array_TooManyElements) {
+TEST_F(ResolverValueConstructorValidationTest, Array_TooManyElements) {
// array<i32, 4u>(1i, 2i, 3i, 4i, 5i);
SetSource(Source::Location({12, 34}));
auto* tc = array<i32, 4>(Expr(1_i), Expr(2_i), Expr(3_i), Expr(4_i), Expr(5_i));
@@ -865,12 +865,12 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- "12:34 error: array initializer has too many "
+ "12:34 error: array constructor has too many "
"elements: expected 4, "
"found 5");
}
-TEST_F(ResolverTypeInitializerValidationTest, Array_Runtime) {
+TEST_F(ResolverValueConstructorValidationTest, Array_Runtime) {
// array<i32>(1i);
auto* tc = array<i32>(Source{{12, 34}}, Expr(1_i));
WrapInFunction(tc);
@@ -879,7 +879,7 @@
EXPECT_EQ(r()->error(), "12:34 error: cannot construct a runtime-sized array");
}
-TEST_F(ResolverTypeInitializerValidationTest, Array_RuntimeZeroValue) {
+TEST_F(ResolverValueConstructorValidationTest, Array_RuntimeZeroValue) {
// array<i32>();
auto* tc = array<i32>(Source{{12, 34}});
WrapInFunction(tc);
@@ -888,11 +888,11 @@
EXPECT_EQ(r()->error(), "12:34 error: cannot construct a runtime-sized array");
}
-} // namespace ArrayInitializer
+} // namespace ArrayConstructor
-namespace ScalarInitializer {
+namespace ScalarConstructor {
-TEST_F(ResolverTypeInitializerValidationTest, I32_Success) {
+TEST_F(ResolverValueConstructorValidationTest, I32_Success) {
auto* expr = Call<i32>(Expr(123_i));
WrapInFunction(expr);
@@ -903,14 +903,14 @@
auto* call = Sem().Get<sem::Call>(expr);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::I32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, U32_Success) {
+TEST_F(ResolverValueConstructorValidationTest, U32_Success) {
auto* expr = Call<u32>(Expr(123_u));
WrapInFunction(expr);
@@ -921,14 +921,14 @@
auto* call = Sem().Get<sem::Call>(expr);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::U32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, F32_Success) {
+TEST_F(ResolverValueConstructorValidationTest, F32_Success) {
auto* expr = Call<f32>(Expr(1.23_f));
WrapInFunction(expr);
@@ -939,14 +939,14 @@
auto* call = Sem().Get<sem::Call>(expr);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::F32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, F16_Success) {
+TEST_F(ResolverValueConstructorValidationTest, F16_Success) {
Enable(builtin::Extension::kF16);
auto* expr = Call<f16>(Expr(1.5_h));
@@ -959,14 +959,14 @@
auto* call = Sem().Get<sem::Call>(expr);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::F16>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Convert_f32_to_i32_Success) {
+TEST_F(ResolverValueConstructorValidationTest, Convert_f32_to_i32_Success) {
auto* expr = Call<i32>(1.23_f);
WrapInFunction(expr);
@@ -977,14 +977,14 @@
auto* call = Sem().Get<sem::Call>(expr);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeConversion>();
+ auto* ctor = call->Target()->As<sem::ValueConversion>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::F32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Convert_i32_to_u32_Success) {
+TEST_F(ResolverValueConstructorValidationTest, Convert_i32_to_u32_Success) {
auto* expr = Call<u32>(123_i);
WrapInFunction(expr);
@@ -995,14 +995,14 @@
auto* call = Sem().Get<sem::Call>(expr);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeConversion>();
+ auto* ctor = call->Target()->As<sem::ValueConversion>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::I32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Convert_u32_to_f16_Success) {
+TEST_F(ResolverValueConstructorValidationTest, Convert_u32_to_f16_Success) {
Enable(builtin::Extension::kF16);
auto* expr = Call<f16>(123_u);
@@ -1015,14 +1015,14 @@
auto* call = Sem().Get<sem::Call>(expr);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeConversion>();
+ auto* ctor = call->Target()->As<sem::ValueConversion>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::U32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Convert_f16_to_f32_Success) {
+TEST_F(ResolverValueConstructorValidationTest, Convert_f16_to_f32_Success) {
Enable(builtin::Extension::kF16);
auto* expr = Call<f32>(123_h);
@@ -1035,109 +1035,109 @@
auto* call = Sem().Get<sem::Call>(expr);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeConversion>();
+ auto* ctor = call->Target()->As<sem::ValueConversion>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::F16>());
}
-} // namespace ScalarInitializer
+} // namespace ScalarConstructor
-namespace VectorInitializer {
+namespace VectorConstructor {
-TEST_F(ResolverTypeInitializerValidationTest, Vec2F32_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2F32_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec2<f32>(Source{{12, 34}}, 1_i, 2_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<f32>(i32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<f32>(i32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2F16_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2F16_Error_ScalarArgumentTypeMismatch) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec2<f16>(Source{{12, 34}}, 1_h, 2_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<f16>(f16, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<f16>(f16, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2U32_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2U32_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec2<u32>(Source{{12, 34}}, 1_u, 2_i));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<u32>(u32, i32)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<u32>(u32, i32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2I32_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2I32_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec2<i32>(Source{{12, 34}}, 1_u, 2_i));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<i32>(u32, i32)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<i32>(u32, i32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2Bool_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2Bool_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec2<bool>(Source{{12, 34}}, true, 1_i));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<bool>(bool, i32)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<bool>(bool, i32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2_Error_Vec3ArgumentCardinalityTooLarge) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2_Error_Vec3ArgumentCardinalityTooLarge) {
WrapInFunction(vec2<f32>(Source{{12, 34}}, vec3<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<f32>(vec3<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<f32>(vec3<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2_Error_Vec4ArgumentCardinalityTooLarge) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2_Error_Vec4ArgumentCardinalityTooLarge) {
WrapInFunction(vec2<f32>(Source{{12, 34}}, vec4<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<f32>(vec4<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<f32>(vec4<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2_Error_TooManyArgumentsScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2_Error_TooManyArgumentsScalar) {
WrapInFunction(vec2<f32>(Source{{12, 34}}, 1_f, 2_f, 3_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<f32>(f32, f32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<f32>(f32, f32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2_Error_TooManyArgumentsVector) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2_Error_TooManyArgumentsVector) {
WrapInFunction(vec2<f32>(Source{{12, 34}}, vec2<f32>(), vec2<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<f32>(vec2<f32>, vec2<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<f32>(vec2<f32>, vec2<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2_Error_TooManyArgumentsVectorAndScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2_Error_TooManyArgumentsVectorAndScalar) {
WrapInFunction(vec2<f32>(Source{{12, 34}}, vec2<f32>(), 1_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<f32>(vec2<f32>, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<f32>(vec2<f32>, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2_Error_InvalidArgumentType) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2_Error_InvalidArgumentType) {
WrapInFunction(vec2<f32>(Source{{12, 34}}, mat2x2<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<f32>(mat2x2<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<f32>(mat2x2<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2_Success_ZeroValue) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2_Success_ZeroValue) {
auto* tc = vec2<f32>();
WrapInFunction(tc);
@@ -1150,13 +1150,13 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 0u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2F32_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2F32_Success_Scalar) {
auto* tc = vec2<f32>(1_f, 1_f);
WrapInFunction(tc);
@@ -1169,7 +1169,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 2u);
@@ -1177,7 +1177,7 @@
EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is<type::F32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2F16_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2F16_Success_Scalar) {
Enable(builtin::Extension::kF16);
auto* tc = vec2<f16>(1_h, 1_h);
@@ -1192,7 +1192,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 2u);
@@ -1200,7 +1200,7 @@
EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is<type::F16>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2U32_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2U32_Success_Scalar) {
auto* tc = vec2<u32>(1_u, 1_u);
WrapInFunction(tc);
@@ -1213,7 +1213,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 2u);
@@ -1221,7 +1221,7 @@
EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is<type::U32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2I32_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2I32_Success_Scalar) {
auto* tc = vec2<i32>(1_i, 1_i);
WrapInFunction(tc);
@@ -1234,7 +1234,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 2u);
@@ -1242,7 +1242,7 @@
EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is<type::I32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2Bool_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2Bool_Success_Scalar) {
auto* tc = vec2<bool>(true, false);
WrapInFunction(tc);
@@ -1255,7 +1255,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 2u);
@@ -1263,7 +1263,7 @@
EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is<type::Bool>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2_Success_Identity) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2_Success_Identity) {
auto* tc = vec2<f32>(vec2<f32>());
WrapInFunction(tc);
@@ -1276,14 +1276,14 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::Vector>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec2_Success_Vec2TypeConversion) {
+TEST_F(ResolverValueConstructorValidationTest, Vec2_Success_Vec2TypeConversion) {
auto* tc = vec2<f32>(vec2<i32>());
WrapInFunction(tc);
@@ -1296,123 +1296,123 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeConversion>();
+ auto* ctor = call->Target()->As<sem::ValueConversion>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::Vector>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3F32_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3F32_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec3<f32>(Source{{12, 34}}, 1_f, 2_f, 3_i));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f32>(f32, f32, i32)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f32>(f32, f32, i32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3F16_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3F16_Error_ScalarArgumentTypeMismatch) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(Source{{12, 34}}, 1_h, 2_h, 3_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f16>(f16, f16, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f16>(f16, f16, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3U32_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3U32_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec3<u32>(Source{{12, 34}}, 1_u, 2_i, 3_u));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<u32>(u32, i32, u32)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<u32>(u32, i32, u32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3I32_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3I32_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec3<i32>(Source{{12, 34}}, 1_i, 2_u, 3_i));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<i32>(i32, u32, i32)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<i32>(i32, u32, i32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3Bool_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3Bool_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec3<bool>(Source{{12, 34}}, false, 1_i, true));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<bool>(bool, i32, bool)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<bool>(bool, i32, bool)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Error_Vec4ArgumentCardinalityTooLarge) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Error_Vec4ArgumentCardinalityTooLarge) {
WrapInFunction(vec3<f32>(Source{{12, 34}}, vec4<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f32>(vec4<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f32>(vec4<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Error_TooFewArgumentsScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Error_TooFewArgumentsScalar) {
WrapInFunction(vec3<f32>(Source{{12, 34}}, 1_f, 2_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f32>(f32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f32>(f32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Error_TooManyArgumentsScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Error_TooManyArgumentsScalar) {
WrapInFunction(vec3<f32>(Source{{12, 34}}, 1_f, 2_f, 3_f, 4_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f32>(f32, f32, f32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f32>(f32, f32, f32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Error_TooFewArgumentsVec2) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Error_TooFewArgumentsVec2) {
WrapInFunction(vec3<f32>(Source{{12, 34}}, vec2<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f32>(vec2<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f32>(vec2<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Error_TooManyArgumentsVec2) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Error_TooManyArgumentsVec2) {
WrapInFunction(vec3<f32>(Source{{12, 34}}, vec2<f32>(), vec2<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f32>(vec2<f32>, vec2<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f32>(vec2<f32>, vec2<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Error_TooManyArgumentsVec2AndScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Error_TooManyArgumentsVec2AndScalar) {
WrapInFunction(vec3<f32>(Source{{12, 34}}, vec2<f32>(), 1_f, 1_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f32>(vec2<f32>, f32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f32>(vec2<f32>, f32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Error_TooManyArgumentsVec3) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Error_TooManyArgumentsVec3) {
WrapInFunction(vec3<f32>(Source{{12, 34}}, vec3<f32>(), 1_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f32>(vec3<f32>, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f32>(vec3<f32>, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Error_InvalidArgumentType) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Error_InvalidArgumentType) {
WrapInFunction(vec3<f32>(Source{{12, 34}}, mat2x2<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f32>(mat2x2<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f32>(mat2x2<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Success_ZeroValue) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Success_ZeroValue) {
auto* tc = vec3<f32>();
WrapInFunction(tc);
@@ -1425,13 +1425,13 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 0u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3F32_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3F32_Success_Scalar) {
auto* tc = vec3<f32>(1_f, 1_f, 1_f);
WrapInFunction(tc);
@@ -1444,7 +1444,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -1453,7 +1453,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::F32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3F16_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3F16_Success_Scalar) {
Enable(builtin::Extension::kF16);
auto* tc = vec3<f16>(1_h, 1_h, 1_h);
@@ -1468,7 +1468,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -1477,7 +1477,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::F16>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3U32_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3U32_Success_Scalar) {
auto* tc = vec3<u32>(1_u, 1_u, 1_u);
WrapInFunction(tc);
@@ -1490,7 +1490,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -1499,7 +1499,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::U32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3I32_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3I32_Success_Scalar) {
auto* tc = vec3<i32>(1_i, 1_i, 1_i);
WrapInFunction(tc);
@@ -1512,7 +1512,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -1521,7 +1521,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::I32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3Bool_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3Bool_Success_Scalar) {
auto* tc = vec3<bool>(true, false, true);
WrapInFunction(tc);
@@ -1534,7 +1534,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 3u);
@@ -1543,7 +1543,7 @@
EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is<type::Bool>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Success_Vec2AndScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Success_Vec2AndScalar) {
auto* tc = vec3<f32>(vec2<f32>(), 1_f);
WrapInFunction(tc);
@@ -1556,7 +1556,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 2u);
@@ -1564,7 +1564,7 @@
EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is<type::F32>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Success_ScalarAndVec2) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Success_ScalarAndVec2) {
auto* tc = vec3<f32>(1_f, vec2<f32>());
WrapInFunction(tc);
@@ -1577,7 +1577,7 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 2u);
@@ -1585,7 +1585,7 @@
EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is<type::Vector>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Success_Identity) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Success_Identity) {
auto* tc = vec3<f32>(vec3<f32>());
WrapInFunction(tc);
@@ -1598,14 +1598,14 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::Vector>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec3_Success_Vec3TypeConversion) {
+TEST_F(ResolverValueConstructorValidationTest, Vec3_Success_Vec3TypeConversion) {
auto* tc = vec3<f32>(vec3<i32>());
WrapInFunction(tc);
@@ -1618,23 +1618,23 @@
auto* call = Sem().Get<sem::Call>(tc);
ASSERT_NE(call, nullptr);
- auto* ctor = call->Target()->As<sem::TypeConversion>();
+ auto* ctor = call->Target()->As<sem::ValueConversion>();
ASSERT_NE(ctor, nullptr);
EXPECT_EQ(call->Type(), ctor->ReturnType());
ASSERT_EQ(ctor->Parameters().Length(), 1u);
EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is<type::Vector>());
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4F32_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4F32_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, 1_f, 1_f, 1_i, 1_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(f32, f32, i32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(f32, f32, i32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4F16_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4F16_Error_ScalarArgumentTypeMismatch) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec4<f16>(Source{{12, 34}}, 1_h, 1_h, 1_f, 1_h));
@@ -1642,142 +1642,142 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f16>(f16, f16, f32, f16)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f16>(f16, f16, f32, f16)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4U32_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4U32_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec4<u32>(Source{{12, 34}}, 1_u, 1_u, 1_i, 1_u));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<u32>(u32, u32, i32, u32)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<u32>(u32, u32, i32, u32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4I32_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4I32_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec4<i32>(Source{{12, 34}}, 1_i, 1_i, 1_u, 1_i));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<i32>(i32, i32, u32, i32)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<i32>(i32, i32, u32, i32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4Bool_Error_ScalarArgumentTypeMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4Bool_Error_ScalarArgumentTypeMismatch) {
WrapInFunction(vec4<bool>(Source{{12, 34}}, true, false, 1_i, true));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<bool>(bool, bool, i32, bool)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<bool>(bool, bool, i32, bool)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooFewArgumentsScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooFewArgumentsScalar) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, 1_f, 2_f, 3_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(f32, f32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(f32, f32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooManyArgumentsScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooManyArgumentsScalar) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, 1_f, 2_f, 3_f, 4_f, 5_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(f32, f32, f32, f32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(f32, f32, f32, f32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooFewArgumentsVec2AndScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooFewArgumentsVec2AndScalar) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, vec2<f32>(), 1_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(vec2<f32>, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(vec2<f32>, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooManyArgumentsVec2AndScalars) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooManyArgumentsVec2AndScalars) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, vec2<f32>(), 1_f, 2_f, 3_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(vec2<f32>, f32, f32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(vec2<f32>, f32, f32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooManyArgumentsVec2Vec2Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooManyArgumentsVec2Vec2Scalar) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, vec2<f32>(), vec2<f32>(), 1_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(vec2<f32>, vec2<f32>, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(vec2<f32>, vec2<f32>, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooManyArgumentsVec2Vec2Vec2) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooManyArgumentsVec2Vec2Vec2) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, vec2<f32>(), vec2<f32>(), vec2<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
HasSubstr(
- "12:34 error: no matching initializer for vec4<f32>(vec2<f32>, vec2<f32>, vec2<f32>)"));
+ "12:34 error: no matching constructor for vec4<f32>(vec2<f32>, vec2<f32>, vec2<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooFewArgumentsVec3) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooFewArgumentsVec3) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, vec3<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(vec3<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(vec3<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooManyArgumentsVec3AndScalars) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooManyArgumentsVec3AndScalars) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, vec3<f32>(), 1_f, 2_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(vec3<f32>, f32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(vec3<f32>, f32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooManyArgumentsVec3AndVec2) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooManyArgumentsVec3AndVec2) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, vec3<f32>(), vec2<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(vec3<f32>, vec2<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(vec3<f32>, vec2<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooManyArgumentsVec2AndVec3) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooManyArgumentsVec2AndVec3) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, vec2<f32>(), vec3<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(vec2<f32>, vec3<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(vec2<f32>, vec3<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_TooManyArgumentsVec3AndVec3) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_TooManyArgumentsVec3AndVec3) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, vec3<f32>(), vec3<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(vec3<f32>, vec3<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(vec3<f32>, vec3<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Error_InvalidArgumentType) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Error_InvalidArgumentType) {
WrapInFunction(vec4<f32>(Source{{12, 34}}, mat2x2<f32>()));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec4<f32>(mat2x2<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for vec4<f32>(mat2x2<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Success_ZeroValue) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Success_ZeroValue) {
auto* tc = vec4<f32>();
WrapInFunction(tc);
@@ -1789,7 +1789,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4F32_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4F32_Success_Scalar) {
auto* tc = vec4<f32>(1_f, 1_f, 1_f, 1_f);
WrapInFunction(tc);
@@ -1801,7 +1801,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4F16_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4F16_Success_Scalar) {
Enable(builtin::Extension::kF16);
auto* tc = vec4<f16>(1_h, 1_h, 1_h, 1_h);
@@ -1815,7 +1815,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4U32_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4U32_Success_Scalar) {
auto* tc = vec4<u32>(1_u, 1_u, 1_u, 1_u);
WrapInFunction(tc);
@@ -1827,7 +1827,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4I32_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4I32_Success_Scalar) {
auto* tc = vec4<i32>(1_i, 1_i, 1_i, 1_i);
WrapInFunction(tc);
@@ -1839,7 +1839,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4Bool_Success_Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4Bool_Success_Scalar) {
auto* tc = vec4<bool>(true, false, true, false);
WrapInFunction(tc);
@@ -1851,7 +1851,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Success_Vec2ScalarScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Success_Vec2ScalarScalar) {
auto* tc = vec4<f32>(vec2<f32>(), 1_f, 1_f);
WrapInFunction(tc);
@@ -1863,7 +1863,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Success_ScalarVec2Scalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Success_ScalarVec2Scalar) {
auto* tc = vec4<f32>(1_f, vec2<f32>(), 1_f);
WrapInFunction(tc);
@@ -1875,7 +1875,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Success_ScalarScalarVec2) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Success_ScalarScalarVec2) {
auto* tc = vec4<f32>(1_f, 1_f, vec2<f32>());
WrapInFunction(tc);
@@ -1887,7 +1887,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Success_Vec2AndVec2) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Success_Vec2AndVec2) {
auto* tc = vec4<f32>(vec2<f32>(), vec2<f32>());
WrapInFunction(tc);
@@ -1899,7 +1899,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Success_Vec3AndScalar) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Success_Vec3AndScalar) {
auto* tc = vec4<f32>(vec3<f32>(), 1_f);
WrapInFunction(tc);
@@ -1911,7 +1911,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Success_ScalarAndVec3) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Success_ScalarAndVec3) {
auto* tc = vec4<f32>(1_f, vec3<f32>());
WrapInFunction(tc);
@@ -1923,7 +1923,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Success_Identity) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Success_Identity) {
auto* tc = vec4<f32>(vec4<f32>());
WrapInFunction(tc);
@@ -1935,7 +1935,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vec4_Success_Vec4TypeConversion) {
+TEST_F(ResolverValueConstructorValidationTest, Vec4_Success_Vec4TypeConversion) {
auto* tc = vec4<f32>(vec4<i32>());
WrapInFunction(tc);
@@ -1947,17 +1947,17 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, NestedVectorInitializers_InnerError) {
+TEST_F(ResolverValueConstructorValidationTest, NestedVectorConstructors_InnerError) {
WrapInFunction(vec4<f32>(vec4<f32>(1_f, 1_f, //
vec3<f32>(Source{{12, 34}}, 1_f, 1_f)),
1_f));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<f32>(f32, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<f32>(f32, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, NestedVectorInitializers_Success) {
+TEST_F(ResolverValueConstructorValidationTest, NestedVectorConstructors_Success) {
auto* tc = vec4<f32>(vec3<f32>(vec2<f32>(1_f, 1_f), 1_f), 1_f);
WrapInFunction(tc);
@@ -1969,7 +1969,7 @@
EXPECT_EQ(TypeOf(tc)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, Vector_Alias_Argument_Error) {
+TEST_F(ResolverValueConstructorValidationTest, Vector_Alias_Argument_Error) {
auto* alias = Alias("UnsignedInt", ty.u32());
GlobalVar("uint_var", ty.Of(alias), builtin::AddressSpace::kPrivate);
@@ -1977,10 +1977,10 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for vec2<f32>(u32)"));
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for vec2<f32>(u32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vector_Alias_Argument_Success) {
+TEST_F(ResolverValueConstructorValidationTest, Vector_Alias_Argument_Success) {
auto* f32_alias = Alias("Float32", ty.f32());
auto* vec2_alias = Alias("VectorFloat2", ty.vec2<f32>());
GlobalVar("my_f32", ty.Of(f32_alias), builtin::AddressSpace::kPrivate);
@@ -1991,7 +1991,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_F(ResolverTypeInitializerValidationTest, Vector_ElementTypeAlias_Error) {
+TEST_F(ResolverValueConstructorValidationTest, Vector_ElementTypeAlias_Error) {
auto* f32_alias = Alias("Float32", ty.f32());
// vec2<Float32>(1.0f, 1u)
@@ -2000,10 +2000,10 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec2<f32>(f32, u32)"));
+ HasSubstr("12:34 error: no matching constructor for vec2<f32>(f32, u32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vector_ElementTypeAlias_Success) {
+TEST_F(ResolverValueConstructorValidationTest, Vector_ElementTypeAlias_Success) {
auto* f32_alias = Alias("Float32", ty.f32());
// vec2<Float32>(1.0f, 1.0f)
@@ -2014,7 +2014,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_F(ResolverTypeInitializerValidationTest, Vector_ArgumentElementTypeAlias_Error) {
+TEST_F(ResolverValueConstructorValidationTest, Vector_ArgumentElementTypeAlias_Error) {
auto* f32_alias = Alias("Float32", ty.f32());
// vec3<u32>(vec<Float32>(), 1.0f)
@@ -2023,10 +2023,10 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("12:34 error: no matching initializer for vec3<u32>(vec2<f32>, f32)"));
+ HasSubstr("12:34 error: no matching constructor for vec3<u32>(vec2<f32>, f32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, Vector_ArgumentElementTypeAlias_Success) {
+TEST_F(ResolverValueConstructorValidationTest, Vector_ArgumentElementTypeAlias_Success) {
auto* f32_alias = Alias("Float32", ty.f32());
// vec3<f32>(vec<Float32>(), 1.0f)
@@ -2037,7 +2037,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromScalars) {
+TEST_F(ResolverValueConstructorValidationTest, InferVec2ElementTypeFromScalars) {
Enable(builtin::Extension::kF16);
auto* vec2_bool = vec2<Infer>(true, false);
@@ -2066,7 +2066,7 @@
EXPECT_EQ(TypeOf(vec2_f16)->As<type::Vector>()->Width(), 2u);
}
-TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromVec2) {
+TEST_F(ResolverValueConstructorValidationTest, InferVec2ElementTypeFromVec2) {
Enable(builtin::Extension::kF16);
auto* vec2_bool = vec2<Infer>(vec2<bool>(true, false));
@@ -2095,7 +2095,7 @@
EXPECT_EQ(TypeOf(vec2_f16)->As<type::Vector>()->Width(), 2u);
}
-TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalars) {
+TEST_F(ResolverValueConstructorValidationTest, InferVec3ElementTypeFromScalars) {
Enable(builtin::Extension::kF16);
auto* vec3_bool = vec3<Infer>(Expr(true), Expr(false), Expr(true));
@@ -2124,7 +2124,7 @@
EXPECT_EQ(TypeOf(vec3_f16)->As<type::Vector>()->Width(), 3u);
}
-TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromVec3) {
+TEST_F(ResolverValueConstructorValidationTest, InferVec3ElementTypeFromVec3) {
Enable(builtin::Extension::kF16);
auto* vec3_bool = vec3<Infer>(vec3<bool>(true, false, true));
@@ -2153,7 +2153,7 @@
EXPECT_EQ(TypeOf(vec3_f16)->As<type::Vector>()->Width(), 3u);
}
-TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalarAndVec2) {
+TEST_F(ResolverValueConstructorValidationTest, InferVec3ElementTypeFromScalarAndVec2) {
Enable(builtin::Extension::kF16);
auto* vec3_bool = vec3<Infer>(Expr(true), vec2<bool>(false, true));
@@ -2182,7 +2182,7 @@
EXPECT_EQ(TypeOf(vec3_f16)->As<type::Vector>()->Width(), 3u);
}
-TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalars) {
+TEST_F(ResolverValueConstructorValidationTest, InferVec4ElementTypeFromScalars) {
Enable(builtin::Extension::kF16);
auto* vec4_bool = vec4<Infer>(Expr(true), Expr(false), Expr(true), Expr(false));
@@ -2211,7 +2211,7 @@
EXPECT_EQ(TypeOf(vec4_f16)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromVec4) {
+TEST_F(ResolverValueConstructorValidationTest, InferVec4ElementTypeFromVec4) {
Enable(builtin::Extension::kF16);
auto* vec4_bool = vec4<Infer>(vec4<bool>(true, false, true, false));
@@ -2240,7 +2240,7 @@
EXPECT_EQ(TypeOf(vec4_f16)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalarAndVec3) {
+TEST_F(ResolverValueConstructorValidationTest, InferVec4ElementTypeFromScalarAndVec3) {
Enable(builtin::Extension::kF16);
auto* vec4_bool = vec4<Infer>(Expr(true), vec3<bool>(false, true, false));
@@ -2269,7 +2269,7 @@
EXPECT_EQ(TypeOf(vec4_f16)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromVec2AndVec2) {
+TEST_F(ResolverValueConstructorValidationTest, InferVec4ElementTypeFromVec2AndVec2) {
Enable(builtin::Extension::kF16);
auto* vec4_bool = vec4<Infer>(vec2<bool>(true, false), vec2<bool>(true, false));
@@ -2298,23 +2298,23 @@
EXPECT_EQ(TypeOf(vec4_f16)->As<type::Vector>()->Width(), 4u);
}
-TEST_F(ResolverTypeInitializerValidationTest, CannotInferVectorElementTypeWithoutArgs) {
+TEST_F(ResolverValueConstructorValidationTest, CannotInferVectorElementTypeWithoutArgs) {
WrapInFunction(Call(Source{{12, 34}}, "vec3"));
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for vec3()"));
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for vec3()"));
}
-TEST_F(ResolverTypeInitializerValidationTest, CannotInferVec2ElementTypeFromScalarsMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, CannotInferVec2ElementTypeFromScalarsMismatch) {
WrapInFunction(Call(Source{{1, 1}}, "vec2", //
Expr(Source{{1, 2}}, 1_i), //
Expr(Source{{1, 3}}, 2_u)));
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("1:1 error: no matching initializer for vec2(i32, u32)"));
+ EXPECT_THAT(r()->error(), HasSubstr("1:1 error: no matching constructor for vec2(i32, u32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, CannotInferVec3ElementTypeFromScalarsMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, CannotInferVec3ElementTypeFromScalarsMismatch) {
WrapInFunction(Call(Source{{1, 1}}, "vec3", //
Expr(Source{{1, 2}}, 1_i), //
Expr(Source{{1, 3}}, 2_u), //
@@ -2322,20 +2322,21 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("1:1 error: no matching initializer for vec3(i32, u32, i32)"));
+ HasSubstr("1:1 error: no matching constructor for vec3(i32, u32, i32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, CannotInferVec3ElementTypeFromScalarAndVec2Mismatch) {
+TEST_F(ResolverValueConstructorValidationTest,
+ CannotInferVec3ElementTypeFromScalarAndVec2Mismatch) {
WrapInFunction(Call(Source{{1, 1}}, "vec3", //
Expr(Source{{1, 2}}, 1_i), //
Call(Source{{1, 3}}, ty.vec2<f32>(), 2_f, 3_f)));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("1:1 error: no matching initializer for vec3(i32, vec2<f32>)"));
+ HasSubstr("1:1 error: no matching constructor for vec3(i32, vec2<f32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, CannotInferVec4ElementTypeFromScalarsMismatch) {
+TEST_F(ResolverValueConstructorValidationTest, CannotInferVec4ElementTypeFromScalarsMismatch) {
WrapInFunction(Call(Source{{1, 1}}, "vec4", //
Expr(Source{{1, 2}}, 1_i), //
Expr(Source{{1, 3}}, 2_i), //
@@ -2344,32 +2345,33 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("1:1 error: no matching initializer for vec4(i32, i32, f32, i32)"));
+ HasSubstr("1:1 error: no matching constructor for vec4(i32, i32, f32, i32)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, CannotInferVec4ElementTypeFromScalarAndVec3Mismatch) {
+TEST_F(ResolverValueConstructorValidationTest,
+ CannotInferVec4ElementTypeFromScalarAndVec3Mismatch) {
WrapInFunction(Call(Source{{1, 1}}, "vec4", //
Expr(Source{{1, 2}}, 1_i), //
Call(Source{{1, 3}}, ty.vec3<u32>(), 2_u, 3_u, 4_u)));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("1:1 error: no matching initializer for vec4(i32, vec3<u32>)"));
+ HasSubstr("1:1 error: no matching constructor for vec4(i32, vec3<u32>)"));
}
-TEST_F(ResolverTypeInitializerValidationTest, CannotInferVec4ElementTypeFromVec2AndVec2Mismatch) {
+TEST_F(ResolverValueConstructorValidationTest, CannotInferVec4ElementTypeFromVec2AndVec2Mismatch) {
WrapInFunction(Call(Source{{1, 1}}, "vec4", //
Call(Source{{1, 2}}, ty.vec2<i32>(), 3_i, 4_i), //
Call(Source{{1, 3}}, ty.vec2<u32>(), 3_u, 4_u)));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(r()->error(),
- HasSubstr("1:1 error: no matching initializer for vec4(vec2<i32>, vec2<u32>)"));
+ HasSubstr("1:1 error: no matching constructor for vec4(vec2<i32>, vec2<u32>)"));
}
-} // namespace VectorInitializer
+} // namespace VectorConstructor
-namespace MatrixInitializer {
+namespace MatrixConstructor {
struct MatrixParams {
using name_func_ptr = std::string (*)();
@@ -2401,9 +2403,9 @@
param.get_element_type_name() + ">";
}
-using MatrixInitializerTest = ResolverTestWithParam<MatrixParams>;
+using MatrixConstructorTest = ResolverTestWithParam<MatrixParams>;
-TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooFewArguments) {
+TEST_P(MatrixConstructorTest, ColumnConstructor_Error_TooFewArguments) {
// matNxM<f32>(vecM<f32>(), ...); with N - 1 arguments
// matNxM<f16>(vecM<f16>(), ...); with N - 1 arguments
@@ -2428,11 +2430,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for " +
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " +
MatrixStr(param) + "(" + args_tys.str() + ")"));
}
-TEST_P(MatrixInitializerTest, ElementInitializer_Error_TooFewArguments) {
+TEST_P(MatrixConstructorTest, ElementConstructor_Error_TooFewArguments) {
// matNxM<f32>(f32,...,f32); with N*M - 1 arguments
// matNxM<f16>(f16,...,f16); with N*M - 1 arguments
@@ -2456,11 +2458,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for " +
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " +
MatrixStr(param) + "(" + args_tys.str() + ")"));
}
-TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooManyArguments) {
+TEST_P(MatrixConstructorTest, ColumnConstructor_Error_TooManyArguments) {
// matNxM<f32>(vecM<f32>(), ...); with N + 1 arguments
// matNxM<f16>(vecM<f16>(), ...); with N + 1 arguments
@@ -2485,11 +2487,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for " +
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " +
MatrixStr(param) + "(" + args_tys.str() + ")"));
}
-TEST_P(MatrixInitializerTest, ElementInitializer_Error_TooManyArguments) {
+TEST_P(MatrixConstructorTest, ElementConstructor_Error_TooManyArguments) {
// matNxM<f32>(f32,...,f32); with N*M + 1 arguments
// matNxM<f16>(f16,...,f16); with N*M + 1 arguments
@@ -2513,11 +2515,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for " +
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " +
MatrixStr(param) + "(" + args_tys.str() + ")"));
}
-TEST_P(MatrixInitializerTest, ColumnInitializer_Error_InvalidArgumentType) {
+TEST_P(MatrixConstructorTest, ColumnConstructor_Error_InvalidArgumentType) {
// matNxM<f32>(vec<u32>, vec<u32>, ...); N arguments
// matNxM<f16>(vec<u32>, vec<u32>, ...); N arguments
@@ -2541,11 +2543,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for " +
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " +
MatrixStr(param) + "(" + args_tys.str() + ")"));
}
-TEST_P(MatrixInitializerTest, ElementInitializer_Error_InvalidArgumentType) {
+TEST_P(MatrixConstructorTest, ElementConstructor_Error_InvalidArgumentType) {
// matNxM<f32>(u32, u32, ...); N*M arguments
// matNxM<f16>(u32, u32, ...); N*M arguments
@@ -2568,11 +2570,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for " +
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " +
MatrixStr(param) + "(" + args_tys.str() + ")"));
}
-TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooFewRowsInVectorArgument) {
+TEST_P(MatrixConstructorTest, ColumnConstructor_Error_TooFewRowsInVectorArgument) {
// matNxM<f32>(vecM<f32>(),...,vecM-1<f32>());
// matNxM<f16>(vecM<f16>(),...,vecM-1<f32>());
@@ -2606,11 +2608,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for " +
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " +
MatrixStr(param) + "(" + args_tys.str() + ")"));
}
-TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooManyRowsInVectorArgument) {
+TEST_P(MatrixConstructorTest, ColumnConstructor_Error_TooManyRowsInVectorArgument) {
// matNxM<f32>(vecM<f32>(),...,vecM+1<f32>());
// matNxM<f16>(vecM<f16>(),...,vecM+1<f16>());
@@ -2643,11 +2645,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for " +
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " +
MatrixStr(param) + "(" + args_tys.str() + ")"));
}
-TEST_P(MatrixInitializerTest, ZeroValue_Success) {
+TEST_P(MatrixConstructorTest, ZeroValue_Success) {
// matNxM<f32>();
// matNxM<f16>();
@@ -2662,7 +2664,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_P(MatrixInitializerTest, WithColumns_Success) {
+TEST_P(MatrixConstructorTest, WithColumns_Success) {
// matNxM<f32>(vecM<f32>(), ...); with N arguments
// matNxM<f16>(vecM<f16>(), ...); with N arguments
@@ -2683,7 +2685,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_P(MatrixInitializerTest, WithElements_Success) {
+TEST_P(MatrixConstructorTest, WithElements_Success) {
// matNxM<f32>(f32,...,f32); with N*M arguments
// matNxM<f16>(f16,...,f16); with N*M arguments
@@ -2703,7 +2705,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_P(MatrixInitializerTest, ElementTypeAlias_Error) {
+TEST_P(MatrixConstructorTest, ElementTypeAlias_Error) {
// matNxM<Float32>(vecM<u32>(), ...); with N arguments
// matNxM<Float16>(vecM<u32>(), ...); with N arguments
@@ -2729,11 +2731,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for " +
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " +
MatrixStr(param) + "(" + args_tys.str() + ")"));
}
-TEST_P(MatrixInitializerTest, ElementTypeAlias_Success) {
+TEST_P(MatrixConstructorTest, ElementTypeAlias_Success) {
// matNxM<Float32>(vecM<f32>(), ...); with N arguments
// matNxM<Float16>(vecM<f16>(), ...); with N arguments
@@ -2756,7 +2758,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_F(ResolverTypeInitializerValidationTest, MatrixInitializer_ArgumentTypeAlias_Error) {
+TEST_F(ResolverValueConstructorValidationTest, MatrixConstructor_ArgumentTypeAlias_Error) {
auto* alias = Alias("VectorUnsigned2", ty.vec2<u32>());
auto* tc = Call(Source{{12, 34}}, ty.mat2x2<f32>(), Call(ty.Of(alias)), vec2<f32>());
WrapInFunction(tc);
@@ -2764,10 +2766,10 @@
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
r()->error(),
- HasSubstr("12:34 error: no matching initializer for mat2x2<f32>(vec2<u32>, vec2<f32>)"));
+ HasSubstr("12:34 error: no matching constructor for mat2x2<f32>(vec2<u32>, vec2<f32>)"));
}
-TEST_P(MatrixInitializerTest, ArgumentTypeAlias_Success) {
+TEST_P(MatrixConstructorTest, ArgumentTypeAlias_Success) {
const auto param = GetParam();
Enable(builtin::Extension::kF16);
@@ -2787,7 +2789,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Error) {
+TEST_P(MatrixConstructorTest, ArgumentElementTypeAlias_Error) {
const auto param = GetParam();
Enable(builtin::Extension::kF16);
@@ -2810,11 +2812,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching initializer for " +
+ EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " +
MatrixStr(param) + "(" + args_tys.str() + ")"));
}
-TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Success) {
+TEST_P(MatrixConstructorTest, ArgumentElementTypeAlias_Success) {
const auto param = GetParam();
Enable(builtin::Extension::kF16);
@@ -2834,7 +2836,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_P(MatrixInitializerTest, InferElementTypeFromVectors) {
+TEST_P(MatrixConstructorTest, InferElementTypeFromVectors) {
const auto param = GetParam();
Enable(builtin::Extension::kF16);
@@ -2851,7 +2853,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_P(MatrixInitializerTest, InferElementTypeFromScalars) {
+TEST_P(MatrixConstructorTest, InferElementTypeFromScalars) {
const auto param = GetParam();
Enable(builtin::Extension::kF16);
@@ -2867,13 +2869,13 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_P(MatrixInitializerTest, CannotInferElementTypeFromVectors_Mismatch) {
+TEST_P(MatrixConstructorTest, CannotInferElementTypeFromVectors_Mismatch) {
const auto param = GetParam();
Enable(builtin::Extension::kF16);
std::stringstream err;
- err << "12:34 error: no matching initializer for mat" << param.columns << "x" << param.rows
+ err << "12:34 error: no matching constructor for mat" << param.columns << "x" << param.rows
<< "(";
utils::Vector<const ast::Expression*, 8> args;
@@ -2898,13 +2900,13 @@
EXPECT_THAT(r()->error(), HasSubstr(err.str()));
}
-TEST_P(MatrixInitializerTest, CannotInferElementTypeFromScalars_Mismatch) {
+TEST_P(MatrixConstructorTest, CannotInferElementTypeFromScalars_Mismatch) {
const auto param = GetParam();
Enable(builtin::Extension::kF16);
std::stringstream err;
- err << "12:34 error: no matching initializer for mat" << param.columns << "x" << param.rows
+ err << "12:34 error: no matching constructor for mat" << param.columns << "x" << param.rows
<< "(";
utils::Vector<const ast::Expression*, 16> args;
@@ -2930,8 +2932,8 @@
EXPECT_THAT(r()->error(), HasSubstr(err.str()));
}
-INSTANTIATE_TEST_SUITE_P(ResolverTypeInitializerValidationTest,
- MatrixInitializerTest,
+INSTANTIATE_TEST_SUITE_P(ResolverValueConstructorValidationTest,
+ MatrixConstructorTest,
testing::Values(MatrixParamsFor<f32, 2, 2>(),
MatrixParamsFor<f32, 3, 2>(),
MatrixParamsFor<f32, 4, 2>(),
@@ -2950,9 +2952,9 @@
MatrixParamsFor<f16, 2, 4>(),
MatrixParamsFor<f16, 3, 4>(),
MatrixParamsFor<f16, 4, 4>()));
-} // namespace MatrixInitializer
+} // namespace MatrixConstructor
-namespace StructInitializer {
+namespace StructConstructor {
using builder::CreatePtrs;
using builder::CreatePtrsFor;
using builder::mat2x2;
@@ -2983,10 +2985,10 @@
auto number_of_members = testing::Values(2u, 32u, 64u);
-using StructInitializerInputsTest =
+using StructConstructorInputsTest =
ResolverTestWithParam<std::tuple<CreatePtrs, // struct member type
uint32_t>>; // number of struct members
-TEST_P(StructInitializerInputsTest, TooFew) {
+TEST_P(StructConstructorInputsTest, TooFew) {
auto& param = GetParam();
auto& str_params = std::get<0>(param);
uint32_t N = std::get<1>(param);
@@ -3007,11 +3009,11 @@
auto* tc = Call(Source{{12, 34}}, ty.Of(s), values);
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(), "12:34 error: struct initializer has too few inputs: expected " +
+ EXPECT_EQ(r()->error(), "12:34 error: structure constructor has too few inputs: expected " +
std::to_string(N) + ", found " + std::to_string(N - 1));
}
-TEST_P(StructInitializerInputsTest, TooMany) {
+TEST_P(StructConstructorInputsTest, TooMany) {
auto& param = GetParam();
auto& str_params = std::get<0>(param);
uint32_t N = std::get<1>(param);
@@ -3032,18 +3034,18 @@
auto* tc = Call(Source{{12, 34}}, ty.Of(s), values);
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(), "12:34 error: struct initializer has too many inputs: expected " +
+ EXPECT_EQ(r()->error(), "12:34 error: structure constructor has too many inputs: expected " +
std::to_string(N) + ", found " + std::to_string(N + 1));
}
-INSTANTIATE_TEST_SUITE_P(ResolverTypeInitializerValidationTest,
- StructInitializerInputsTest,
+INSTANTIATE_TEST_SUITE_P(ResolverValueConstructorValidationTest,
+ StructConstructorInputsTest,
testing::Combine(testing::ValuesIn(all_types), number_of_members));
-using StructInitializerTypeTest =
+using StructConstructorTypeTest =
ResolverTestWithParam<std::tuple<CreatePtrs, // struct member type
- CreatePtrs, // initializer value type
+ CreatePtrs, // constructor value type
uint32_t>>; // number of struct members
-TEST_P(StructInitializerTypeTest, AllTypes) {
+TEST_P(StructConstructorTypeTest, AllTypes) {
auto& param = GetParam();
auto& str_params = std::get<0>(param);
auto& ctor_params = std::get<1>(param);
@@ -3057,12 +3059,12 @@
utils::Vector<const ast::StructMember*, 16> members;
utils::Vector<const ast::Expression*, 8> values;
- // make the last value of the initializer to have a different type
- uint32_t initializer_value_with_different_type = N - 1;
+ // make the last value of the constructor to have a different type
+ uint32_t constructor_value_with_different_type = N - 1;
for (uint32_t i = 0; i < N; i++) {
ast::Type struct_type = str_params.ast(*this);
members.Push(Member("member_" + std::to_string(i), struct_type));
- auto* ctor_value_expr = (i == initializer_value_with_different_type)
+ auto* ctor_value_expr = (i == constructor_value_with_different_type)
? ctor_params.expr_from_double(*this, 0)
: str_params.expr_from_double(*this, 0);
values.Push(ctor_value_expr);
@@ -3072,19 +3074,19 @@
WrapInFunction(tc);
std::stringstream err;
- err << "error: type in struct initializer does not match struct member ";
+ err << "error: type in structure constructor does not match struct member ";
err << "type: expected '" << str_params.name() << "', found '" << ctor_params.name() << "'";
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), err.str());
}
-INSTANTIATE_TEST_SUITE_P(ResolverTypeInitializerValidationTest,
- StructInitializerTypeTest,
+INSTANTIATE_TEST_SUITE_P(ResolverValueConstructorValidationTest,
+ StructConstructorTypeTest,
testing::Combine(testing::ValuesIn(all_types),
testing::ValuesIn(all_types),
number_of_members));
-TEST_F(ResolverTypeInitializerValidationTest, Struct_Nested) {
+TEST_F(ResolverValueConstructorValidationTest, Struct_Nested) {
auto* inner_m = Member("m", ty.i32());
auto* inner_s = Structure("inner_s", utils::Vector{inner_m});
@@ -3097,11 +3099,11 @@
WrapInFunction(tc);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
- "error: type in struct initializer does not match struct member "
+ "error: type in structure constructor does not match struct member "
"type: expected 'inner_s', found 'i32'");
}
-TEST_F(ResolverTypeInitializerValidationTest, Struct) {
+TEST_F(ResolverValueConstructorValidationTest, Struct) {
auto* m = Member("m", ty.i32());
auto* s = Structure("MyInputs", utils::Vector{m});
auto* tc = Call(Source{{12, 34}}, ty.Of(s));
@@ -3109,7 +3111,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-TEST_F(ResolverTypeInitializerValidationTest, Struct_Empty) {
+TEST_F(ResolverValueConstructorValidationTest, Struct_Empty) {
auto* str = Structure("S", utils::Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
@@ -3119,31 +3121,31 @@
WrapInFunction(Call(ty.Of(str)));
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
-} // namespace StructInitializer
+} // namespace StructConstructor
-TEST_F(ResolverTypeInitializerValidationTest, NonConstructibleType_Atomic) {
+TEST_F(ResolverValueConstructorValidationTest, NonConstructibleType_Atomic) {
WrapInFunction(Assign(Phony(), Call(Source{{12, 34}}, ty.atomic(ty.i32()))));
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: type is not constructible");
}
-TEST_F(ResolverTypeInitializerValidationTest, NonConstructibleType_AtomicArray) {
+TEST_F(ResolverValueConstructorValidationTest, NonConstructibleType_AtomicArray) {
WrapInFunction(Assign(Phony(), Call(Source{{12, 34}}, ty.array(ty.atomic(ty.i32()), 4_i))));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(), "12:34 error: array initializer has non-constructible element type");
+ EXPECT_EQ(r()->error(), "12:34 error: array constructor has non-constructible element type");
}
-TEST_F(ResolverTypeInitializerValidationTest, NonConstructibleType_AtomicStructMember) {
+TEST_F(ResolverValueConstructorValidationTest, NonConstructibleType_AtomicStructMember) {
auto* str = Structure("S", utils::Vector{Member("a", ty.atomic(ty.i32()))});
WrapInFunction(Assign(Phony(), Call(Source{{12, 34}}, ty.Of(str))));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(), "12:34 error: struct initializer has non-constructible type");
+ EXPECT_EQ(r()->error(), "12:34 error: structure constructor has non-constructible type");
}
-TEST_F(ResolverTypeInitializerValidationTest, NonConstructibleType_Sampler) {
+TEST_F(ResolverValueConstructorValidationTest, NonConstructibleType_Sampler) {
WrapInFunction(
Assign(Phony(), Call(Source{{12, 34}}, ty.sampler(type::SamplerKind::kSampler))));
@@ -3151,42 +3153,42 @@
EXPECT_EQ(r()->error(), "12:34 error: type is not constructible");
}
-TEST_F(ResolverTypeInitializerValidationTest, BuilinTypeInitializerAsStatement) {
+TEST_F(ResolverValueConstructorValidationTest, BuilinTypeConstructorAsStatement) {
WrapInFunction(CallStmt(vec2<f32>(Source{{12, 34}}, 1_f, 2_f)));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(), "12:34 error: type initializer evaluated but not used");
+ EXPECT_EQ(r()->error(), "12:34 error: value constructor evaluated but not used");
}
-TEST_F(ResolverTypeInitializerValidationTest, StructInitializerAsStatement) {
+TEST_F(ResolverValueConstructorValidationTest, StructConstructorAsStatement) {
Structure("S", utils::Vector{Member("m", ty.i32())});
WrapInFunction(CallStmt(Call(Source{{12, 34}}, "S", 1_a)));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(), "12:34 error: type initializer evaluated but not used");
+ EXPECT_EQ(r()->error(), "12:34 error: value constructor evaluated but not used");
}
-TEST_F(ResolverTypeInitializerValidationTest, AliasInitializerAsStatement) {
+TEST_F(ResolverValueConstructorValidationTest, AliasConstructorAsStatement) {
Alias("A", ty.i32());
WrapInFunction(CallStmt(Call(Source{{12, 34}}, "A", 1_i)));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(), "12:34 error: type initializer evaluated but not used");
+ EXPECT_EQ(r()->error(), "12:34 error: value constructor evaluated but not used");
}
-TEST_F(ResolverTypeInitializerValidationTest, BuilinTypeConversionAsStatement) {
+TEST_F(ResolverValueConstructorValidationTest, BuilinTypeConversionAsStatement) {
WrapInFunction(CallStmt(Call(Source{{12, 34}}, ty.f32(), 1_i)));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(), "12:34 error: type conversion evaluated but not used");
+ EXPECT_EQ(r()->error(), "12:34 error: value conversion evaluated but not used");
}
-TEST_F(ResolverTypeInitializerValidationTest, AliasConversionAsStatement) {
+TEST_F(ResolverValueConstructorValidationTest, AliasConversionAsStatement) {
Alias("A", ty.i32());
WrapInFunction(CallStmt(Call(Source{{12, 34}}, "A", 1_f)));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(), "12:34 error: type conversion evaluated but not used");
+ EXPECT_EQ(r()->error(), "12:34 error: value conversion evaluated but not used");
}
} // namespace
diff --git a/src/tint/sem/call_target.h b/src/tint/sem/call_target.h
index 153eb8a..4f0ab33 100644
--- a/src/tint/sem/call_target.h
+++ b/src/tint/sem/call_target.h
@@ -62,8 +62,8 @@
}
};
-/// CallTarget is the base for callable functions, builtins, type initializers
-/// and type casts.
+/// CallTarget is the base for callable functions, builtins, value constructors and value
+/// conversions.
class CallTarget : public Castable<CallTarget, Node> {
public:
/// Constructor
diff --git a/src/tint/sem/type_initializer.cc b/src/tint/sem/value_constructor.cc
similarity index 67%
rename from src/tint/sem/type_initializer.cc
rename to src/tint/sem/value_constructor.cc
index d6e0383..62be478 100644
--- a/src/tint/sem/type_initializer.cc
+++ b/src/tint/sem/value_constructor.cc
@@ -12,19 +12,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
#include <utility>
-TINT_INSTANTIATE_TYPEINFO(tint::sem::TypeInitializer);
+TINT_INSTANTIATE_TYPEINFO(tint::sem::ValueConstructor);
namespace tint::sem {
-TypeInitializer::TypeInitializer(const type::Type* type,
- utils::VectorRef<const Parameter*> parameters,
- EvaluationStage stage)
+ValueConstructor::ValueConstructor(const type::Type* type,
+ utils::VectorRef<const Parameter*> parameters,
+ EvaluationStage stage)
: Base(type, std::move(parameters), stage, /* must_use */ true) {}
-TypeInitializer::~TypeInitializer() = default;
+ValueConstructor::~ValueConstructor() = default;
} // namespace tint::sem
diff --git a/src/tint/sem/type_initializer.h b/src/tint/sem/value_constructor.h
similarity index 63%
rename from src/tint/sem/type_initializer.h
rename to src/tint/sem/value_constructor.h
index b46faa8..aef827b 100644
--- a/src/tint/sem/type_initializer.h
+++ b/src/tint/sem/value_constructor.h
@@ -12,29 +12,29 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef SRC_TINT_SEM_TYPE_INITIALIZER_H_
-#define SRC_TINT_SEM_TYPE_INITIALIZER_H_
+#ifndef SRC_TINT_SEM_VALUE_CONSTRUCTOR_H_
+#define SRC_TINT_SEM_VALUE_CONSTRUCTOR_H_
#include "src/tint/sem/call_target.h"
#include "src/tint/utils/vector.h"
namespace tint::sem {
-/// TypeInitializer is the CallTarget for a type initializer.
-class TypeInitializer final : public Castable<TypeInitializer, CallTarget> {
+/// ValueConstructor is the CallTarget for a value constructor.
+class ValueConstructor final : public Castable<ValueConstructor, CallTarget> {
public:
/// Constructor
/// @param type the type that's being constructed
- /// @param parameters the type initializer parameters
+ /// @param parameters the constructor parameters
/// @param stage the earliest evaluation stage for the expression
- TypeInitializer(const type::Type* type,
- utils::VectorRef<const Parameter*> parameters,
- EvaluationStage stage);
+ ValueConstructor(const type::Type* type,
+ utils::VectorRef<const Parameter*> parameters,
+ EvaluationStage stage);
/// Destructor
- ~TypeInitializer() override;
+ ~ValueConstructor() override;
};
} // namespace tint::sem
-#endif // SRC_TINT_SEM_TYPE_INITIALIZER_H_
+#endif // SRC_TINT_SEM_VALUE_CONSTRUCTOR_H_
diff --git a/src/tint/sem/type_conversion.cc b/src/tint/sem/value_conversion.cc
similarity index 69%
rename from src/tint/sem/type_conversion.cc
rename to src/tint/sem/value_conversion.cc
index e33fdad..37331af 100644
--- a/src/tint/sem/type_conversion.cc
+++ b/src/tint/sem/value_conversion.cc
@@ -12,17 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "src/tint/sem/type_conversion.h"
+#include "src/tint/sem/value_conversion.h"
-TINT_INSTANTIATE_TYPEINFO(tint::sem::TypeConversion);
+TINT_INSTANTIATE_TYPEINFO(tint::sem::ValueConversion);
namespace tint::sem {
-TypeConversion::TypeConversion(const type::Type* type,
- const sem::Parameter* parameter,
- EvaluationStage stage)
+ValueConversion::ValueConversion(const type::Type* type,
+ const sem::Parameter* parameter,
+ EvaluationStage stage)
: Base(type, utils::Vector<const sem::Parameter*, 1>{parameter}, stage, /* must_use */ true) {}
-TypeConversion::~TypeConversion() = default;
+ValueConversion::~ValueConversion() = default;
} // namespace tint::sem
diff --git a/src/tint/sem/type_conversion.h b/src/tint/sem/value_conversion.h
similarity index 73%
rename from src/tint/sem/type_conversion.h
rename to src/tint/sem/value_conversion.h
index c489127..b79caa3 100644
--- a/src/tint/sem/type_conversion.h
+++ b/src/tint/sem/value_conversion.h
@@ -12,24 +12,24 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef SRC_TINT_SEM_TYPE_CONVERSION_H_
-#define SRC_TINT_SEM_TYPE_CONVERSION_H_
+#ifndef SRC_TINT_SEM_VALUE_CONVERSION_H_
+#define SRC_TINT_SEM_VALUE_CONVERSION_H_
#include "src/tint/sem/call_target.h"
namespace tint::sem {
-/// TypeConversion is the CallTarget for a type conversion (cast).
-class TypeConversion final : public Castable<TypeConversion, CallTarget> {
+/// ValueConversion is the CallTarget for a value conversion (cast).
+class ValueConversion final : public Castable<ValueConversion, CallTarget> {
public:
/// Constructor
/// @param type the target type of the cast
/// @param parameter the type cast parameter
/// @param stage the earliest evaluation stage for the expression
- TypeConversion(const type::Type* type, const sem::Parameter* parameter, EvaluationStage stage);
+ ValueConversion(const type::Type* type, const sem::Parameter* parameter, EvaluationStage stage);
/// Destructor
- ~TypeConversion() override;
+ ~ValueConversion() override;
/// @returns the cast source type
const type::Type* Source() const { return Parameters()[0]->Type(); }
@@ -40,4 +40,4 @@
} // namespace tint::sem
-#endif // SRC_TINT_SEM_TYPE_CONVERSION_H_
+#endif // SRC_TINT_SEM_VALUE_CONVERSION_H_
diff --git a/src/tint/transform/decompose_strided_array.cc b/src/tint/transform/decompose_strided_array.cc
index e92b85e..838948e 100644
--- a/src/tint/transform/decompose_strided_array.cc
+++ b/src/tint/transform/decompose_strided_array.cc
@@ -22,7 +22,7 @@
#include "src/tint/sem/call.h"
#include "src/tint/sem/member_accessor_expression.h"
#include "src/tint/sem/type_expression.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
#include "src/tint/sem/value_expression.h"
#include "src/tint/transform/simplify_pointers.h"
#include "src/tint/utils/hash.h"
@@ -134,18 +134,16 @@
return nullptr;
});
- // Find all array type initializer expressions for array types that have had
- // their element changed to a single field structure. These initializers are
- // adjusted to wrap each of the arguments with an additional initializer for
- // the new element structure type.
- // Example:
+ // Find all constructor expressions for array types that have had their element changed to a
+ // single field structure. These constructors are adjusted to wrap each of the arguments with an
+ // additional initializer for the new element structure type. Example:
// `@stride(32) array<i32, 3>(1, 2, 3)`
// ->
// `array<strided_arr, 3>(strided_arr(1), strided_arr(2), strided_arr(3))`
ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::Expression* {
if (!expr->args.IsEmpty()) {
if (auto* call = sem.Get(expr)->UnwrapMaterialize()->As<sem::Call>()) {
- if (auto* ctor = call->Target()->As<sem::TypeInitializer>()) {
+ if (auto* ctor = call->Target()->As<sem::ValueConstructor>()) {
if (auto* arr = ctor->ReturnType()->As<type::Array>()) {
// Begin by cloning the array initializer type or name
// If this is an unaliased array, this may add a new entry to
diff --git a/src/tint/transform/pad_structs.cc b/src/tint/transform/pad_structs.cc
index eef67eb..79bc631 100644
--- a/src/tint/transform/pad_structs.cc
+++ b/src/tint/transform/pad_structs.cc
@@ -22,7 +22,7 @@
#include "src/tint/program_builder.h"
#include "src/tint/sem/call.h"
#include "src/tint/sem/module.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
using namespace tint::number_suffixes; // NOLINT
@@ -114,7 +114,7 @@
if (!call) {
return nullptr;
}
- auto* cons = call->Target()->As<sem::TypeInitializer>();
+ auto* cons = call->Target()->As<sem::ValueConstructor>();
if (!cons) {
return nullptr;
}
diff --git a/src/tint/transform/promote_initializers_to_let.cc b/src/tint/transform/promote_initializers_to_let.cc
index 7bc7d51..e201f11 100644
--- a/src/tint/transform/promote_initializers_to_let.cc
+++ b/src/tint/transform/promote_initializers_to_let.cc
@@ -20,7 +20,7 @@
#include "src/tint/program_builder.h"
#include "src/tint/sem/call.h"
#include "src/tint/sem/statement.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
#include "src/tint/transform/utils/hoist_to_decl_before.h"
#include "src/tint/type/struct.h"
#include "src/tint/utils/hashset.h"
@@ -58,8 +58,8 @@
}
auto* ctor = root_expr->UnwrapMaterialize()->As<sem::Call>();
- if (!ctor || !ctor->Target()->Is<sem::TypeInitializer>()) {
- // Root expression is not a type constructor. Not interested in this.
+ if (!ctor || !ctor->Target()->Is<sem::ValueConstructor>()) {
+ // Root expression is not a value constructor. Not interested in this.
return false;
}
}
diff --git a/src/tint/transform/remove_phonies.cc b/src/tint/transform/remove_phonies.cc
index 6131892..b6d877d 100644
--- a/src/tint/transform/remove_phonies.cc
+++ b/src/tint/transform/remove_phonies.cc
@@ -61,8 +61,8 @@
if (!ast::TraverseExpressions(
stmt->rhs, b.Diagnostics(), [&](const ast::CallExpression* expr) {
// ast::CallExpression may map to a function or builtin call
- // (both may have side-effects), or a type initializer or
- // type conversion (both do not have side effects).
+ // (both may have side-effects), or a value constructor or value
+ // conversion (both do not have side effects).
auto* call = sem.Get<sem::Call>(expr);
if (!call) {
// Semantic node must be a Materialize, in which case the
diff --git a/src/tint/transform/renamer.cc b/src/tint/transform/renamer.cc
index f2aea29..3ddb6c6 100644
--- a/src/tint/transform/renamer.cc
+++ b/src/tint/transform/renamer.cc
@@ -21,9 +21,9 @@
#include "src/tint/sem/builtin_enum_expression.h"
#include "src/tint/sem/call.h"
#include "src/tint/sem/member_accessor_expression.h"
-#include "src/tint/sem/type_conversion.h"
#include "src/tint/sem/type_expression.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/text/unicode.h"
TINT_INSTANTIATE_TYPEINFO(tint::transform::Renamer);
@@ -1309,10 +1309,10 @@
[&](const sem::Builtin*) {
preserved_identifiers.Add(call->target->identifier);
},
- [&](const sem::TypeConversion*) {
+ [&](const sem::ValueConversion*) {
preserve_if_builtin_type(call->target->identifier);
},
- [&](const sem::TypeInitializer*) {
+ [&](const sem::ValueConstructor*) {
preserve_if_builtin_type(call->target->identifier);
});
});
diff --git a/src/tint/transform/renamer_test.cc b/src/tint/transform/renamer_test.cc
index 4e9e7c6..8ff6898 100644
--- a/src/tint/transform/renamer_test.cc
+++ b/src/tint/transform/renamer_test.cc
@@ -1792,7 +1792,7 @@
TEST_P(RenamerBuiltinTypeTest, PreserveTypeConversion) {
if (std::string_view(GetParam()) == "array") {
- return; // Cannot type convert arrays.
+ return; // Cannot value convert arrays.
}
auto expand = [&](const char* source) {
diff --git a/src/tint/transform/vectorize_matrix_conversions.cc b/src/tint/transform/vectorize_matrix_conversions.cc
index e920417..748346e 100644
--- a/src/tint/transform/vectorize_matrix_conversions.cc
+++ b/src/tint/transform/vectorize_matrix_conversions.cc
@@ -20,7 +20,7 @@
#include "src/tint/program_builder.h"
#include "src/tint/sem/call.h"
-#include "src/tint/sem/type_conversion.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/sem/value_expression.h"
#include "src/tint/type/abstract_numeric.h"
#include "src/tint/utils/hash.h"
@@ -36,7 +36,8 @@
for (auto* node : program->ASTNodes().Objects()) {
if (auto* sem = program->Sem().GetVal(node)) {
if (auto* call = sem->UnwrapMaterialize()->As<sem::Call>()) {
- if (call->Target()->Is<sem::TypeConversion>() && call->Type()->Is<type::Matrix>()) {
+ if (call->Target()->Is<sem::ValueConversion>() &&
+ call->Type()->Is<type::Matrix>()) {
auto& args = call->Arguments();
if (args.Length() == 1 && args[0]->Type()->UnwrapRef()->is_float_matrix()) {
return true;
@@ -71,7 +72,7 @@
ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::CallExpression* {
auto* call = src->Sem().Get(expr)->UnwrapMaterialize()->As<sem::Call>();
- auto* ty_conv = call->Target()->As<sem::TypeConversion>();
+ auto* ty_conv = call->Target()->As<sem::ValueConversion>();
if (!ty_conv) {
return nullptr;
}
diff --git a/src/tint/transform/vectorize_scalar_matrix_initializers.cc b/src/tint/transform/vectorize_scalar_matrix_initializers.cc
index 5c58280..e35cfb3 100644
--- a/src/tint/transform/vectorize_scalar_matrix_initializers.cc
+++ b/src/tint/transform/vectorize_scalar_matrix_initializers.cc
@@ -19,7 +19,7 @@
#include "src/tint/program_builder.h"
#include "src/tint/sem/call.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
#include "src/tint/sem/value_expression.h"
#include "src/tint/type/abstract_numeric.h"
#include "src/tint/utils/map.h"
@@ -32,7 +32,7 @@
bool ShouldRun(const Program* program) {
for (auto* node : program->ASTNodes().Objects()) {
if (auto* call = program->Sem().Get<sem::Call>(node)) {
- if (call->Target()->Is<sem::TypeInitializer>() && call->Type()->Is<type::Matrix>()) {
+ if (call->Target()->Is<sem::ValueConstructor>() && call->Type()->Is<type::Matrix>()) {
auto& args = call->Arguments();
if (!args.IsEmpty() && args[0]->Type()->UnwrapRef()->is_scalar()) {
return true;
@@ -63,7 +63,7 @@
ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::CallExpression* {
auto* call = src->Sem().Get(expr)->UnwrapMaterialize()->As<sem::Call>();
- auto* ty_init = call->Target()->As<sem::TypeInitializer>();
+ auto* ty_init = call->Target()->As<sem::ValueConstructor>();
if (!ty_init) {
return nullptr;
}
diff --git a/src/tint/transform/zero_init_workgroup_memory.cc b/src/tint/transform/zero_init_workgroup_memory.cc
index 7dafc06..9040e09 100644
--- a/src/tint/transform/zero_init_workgroup_memory.cc
+++ b/src/tint/transform/zero_init_workgroup_memory.cc
@@ -436,9 +436,8 @@
}
/// @returns true if a variable with store type `ty` can be efficiently zeroed
- /// by assignment of a type initializer without operands. If
- /// CanTriviallyZero() returns false, then the type needs to be
- /// initialized by decomposing the initialization into multiple
+ /// by assignment of a value constructor without operands. If CanTriviallyZero() returns false,
+ /// then the type needs to be initialized by decomposing the initialization into multiple
/// sub-initializations.
/// @param ty the type to inspect
bool CanTriviallyZero(const type::Type* ty) {
diff --git a/src/tint/utils/block_allocator.h b/src/tint/utils/block_allocator.h
index e75a0c6..b1465cb 100644
--- a/src/tint/utils/block_allocator.h
+++ b/src/tint/utils/block_allocator.h
@@ -210,7 +210,7 @@
/// Creates a new `TYPE` owned by the BlockAllocator.
/// When the BlockAllocator is destructed the object will be destructed and freed.
- /// @param args the arguments to pass to the type constructor
+ /// @param args the arguments to pass to the constructor
/// @returns the pointer to the constructed object
template <typename TYPE = T, typename... ARGS>
TYPE* Create(ARGS&&... args) {
diff --git a/src/tint/writer/append_vector.cc b/src/tint/writer/append_vector.cc
index c212378..c31667d 100644
--- a/src/tint/writer/append_vector.cc
+++ b/src/tint/writer/append_vector.cc
@@ -18,8 +18,8 @@
#include <vector>
#include "src/tint/sem/call.h"
-#include "src/tint/sem/type_conversion.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/sem/value_expression.h"
#include "src/tint/utils/transform.h"
@@ -28,14 +28,14 @@
namespace tint::writer {
namespace {
-struct VectorInitializerInfo {
+struct VectorConstructorInfo {
const sem::Call* call = nullptr;
- const sem::TypeInitializer* ctor = nullptr;
+ const sem::ValueConstructor* ctor = nullptr;
operator bool() const { return call != nullptr; }
};
-VectorInitializerInfo AsVectorInitializer(const sem::ValueExpression* expr) {
+VectorConstructorInfo AsVectorConstructor(const sem::ValueExpression* expr) {
if (auto* call = expr->As<sem::Call>()) {
- if (auto* ctor = call->Target()->As<sem::TypeInitializer>()) {
+ if (auto* ctor = call->Target()->As<sem::ValueConstructor>()) {
if (ctor->ReturnType()->Is<type::Vector>()) {
return {call, ctor};
}
@@ -103,20 +103,20 @@
auto packed_ast_ty = b->ty.vec(packed_el_ast_ty, packed_size);
auto* packed_sem_ty = b->create<type::Vector>(packed_el_sem_ty, packed_size);
- // If the coordinates are already passed in a vector initializer, with only
+ // If the coordinates are already passed in a vector constructor, with only
// scalar components supplied, extract the elements into the new vector
// instead of nesting a vector-in-vector.
- // If the coordinates are a zero-initializer of the vector, then expand that
+ // If the coordinates are a zero-constructor of the vector, then expand that
// to scalar zeros.
- // The other cases for a nested vector initializer are when it is used
+ // The other cases for a nested vector constructor are when it is used
// to convert a vector of a different type, e.g. vec2<i32>(vec2<u32>()).
// In that case, preserve the original argument, or you'll get a type error.
utils::Vector<const sem::ValueExpression*, 4> packed;
- if (auto vc = AsVectorInitializer(vector_sem)) {
+ if (auto vc = AsVectorConstructor(vector_sem)) {
const auto num_supplied = vc.call->Arguments().Length();
if (num_supplied == 0) {
- // Zero-value vector initializer. Populate with zeros
+ // Zero-value vector constructor. Populate with zeros
for (uint32_t i = 0; i < packed_size - 1; i++) {
auto* zero = Zero(*b, packed_el_sem_ty, statement);
packed.Push(zero);
@@ -134,7 +134,7 @@
if (packed_el_sem_ty != scalar_sem->Type()->UnwrapRef()) {
// Cast scalar to the vector element type
auto* scalar_cast_ast = b->Call(packed_el_ast_ty, scalar_ast);
- auto* scalar_cast_target = b->create<sem::TypeConversion>(
+ auto* scalar_cast_target = b->create<sem::ValueConversion>(
packed_el_sem_ty,
b->create<sem::Parameter>(nullptr, 0u, scalar_sem->Type()->UnwrapRef(),
builtin::AddressSpace::kUndefined,
@@ -150,11 +150,11 @@
packed.Push(scalar_sem);
}
- auto* initializer_ast =
+ auto* ctor_ast =
b->Call(packed_ast_ty, utils::Transform(packed, [&](const sem::ValueExpression* expr) {
return expr->Declaration();
}));
- auto* initializer_target = b->create<sem::TypeInitializer>(
+ auto* ctor_target = b->create<sem::ValueConstructor>(
packed_sem_ty,
utils::Transform(
packed,
@@ -164,13 +164,12 @@
builtin::AddressSpace::kUndefined, builtin::Access::kUndefined);
}),
sem::EvaluationStage::kRuntime);
- auto* initializer_sem =
- b->create<sem::Call>(initializer_ast, initializer_target, sem::EvaluationStage::kRuntime,
- std::move(packed), statement,
- /* constant_value */ nullptr,
- /* has_side_effects */ false);
- b->Sem().Add(initializer_ast, initializer_sem);
- return initializer_sem;
+ auto* ctor_sem = b->create<sem::Call>(ctor_ast, ctor_target, sem::EvaluationStage::kRuntime,
+ std::move(packed), statement,
+ /* constant_value */ nullptr,
+ /* has_side_effects */ false);
+ b->Sem().Add(ctor_ast, ctor_sem);
+ return ctor_sem;
}
} // namespace tint::writer
diff --git a/src/tint/writer/append_vector.h b/src/tint/writer/append_vector.h
index 91be10b..0528c52 100644
--- a/src/tint/writer/append_vector.h
+++ b/src/tint/writer/append_vector.h
@@ -30,7 +30,7 @@
/// A helper function used to append a vector with an additional scalar.
/// If the scalar's type does not match the target vector element type,
-/// then it is value-converted (via TypeInitializer) before being added.
+/// then it is value-converted (via ValueConstructor) before being added.
/// All types must have been assigned to the expressions and their child nodes
/// before calling.
/// @param builder the program builder.
diff --git a/src/tint/writer/append_vector_test.cc b/src/tint/writer/append_vector_test.cc
index 8f24916..0303c3c 100644
--- a/src/tint/writer/append_vector_test.cc
+++ b/src/tint/writer/append_vector_test.cc
@@ -16,7 +16,7 @@
#include "src/tint/ast/test_helper.h"
#include "src/tint/program_builder.h"
#include "src/tint/resolver/resolver.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
#include "gtest/gtest.h"
@@ -54,7 +54,7 @@
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
@@ -99,7 +99,7 @@
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
EXPECT_EQ(call->Arguments()[2], Sem().Get(u32_to_i32));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
@@ -149,7 +149,7 @@
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
EXPECT_EQ(call->Arguments()[1], Sem().Get(u32_to_i32));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
@@ -193,7 +193,7 @@
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
EXPECT_EQ(call->Arguments()[2], Sem().Get(f32_to_i32));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
@@ -236,7 +236,7 @@
EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3));
EXPECT_EQ(call->Arguments()[3], Sem().Get(scalar_4));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 4u);
@@ -274,7 +274,7 @@
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
@@ -314,7 +314,7 @@
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
@@ -352,7 +352,7 @@
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
@@ -393,7 +393,7 @@
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
EXPECT_EQ(call->Arguments()[1], Sem().Get(f32_to_i32));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
@@ -430,7 +430,7 @@
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
@@ -471,7 +471,7 @@
EXPECT_EQ(call->Arguments()[2], Sem().Get(vec_0004->args[2]));
EXPECT_EQ(call->Arguments()[3], Sem().Get(scalar));
- auto* ctor = call->Target()->As<sem::TypeInitializer>();
+ auto* ctor = call->Target()->As<sem::ValueConstructor>();
ASSERT_NE(ctor, nullptr);
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 4u);
diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc
index 147cc57..e8b5b9b 100644
--- a/src/tint/writer/glsl/generator_impl.cc
+++ b/src/tint/writer/glsl/generator_impl.cc
@@ -36,8 +36,8 @@
#include "src/tint/sem/statement.h"
#include "src/tint/sem/struct.h"
#include "src/tint/sem/switch_statement.h"
-#include "src/tint/sem/type_conversion.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/sem/variable.h"
#include "src/tint/transform/add_block_attribute.h"
#include "src/tint/transform/add_empty_entry_point.h"
@@ -712,8 +712,8 @@
call->Target(), //
[&](const sem::Function* fn) { return EmitFunctionCall(out, call, fn); },
[&](const sem::Builtin* builtin) { return EmitBuiltinCall(out, call, builtin); },
- [&](const sem::TypeConversion* conv) { return EmitTypeConversion(out, call, conv); },
- [&](const sem::TypeInitializer* init) { return EmitTypeInitializer(out, call, init); },
+ [&](const sem::ValueConversion* conv) { return EmitValueConversion(out, call, conv); },
+ [&](const sem::ValueConstructor* ctor) { return EmitValueConstructor(out, call, ctor); },
[&](Default) {
TINT_ICE(Writer, diagnostics_)
<< "unhandled call target: " << call->Target()->TypeInfo().name;
@@ -827,9 +827,9 @@
return true;
}
-bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
- const sem::Call* call,
- const sem::TypeConversion* conv) {
+bool GeneratorImpl::EmitValueConversion(std::ostream& out,
+ const sem::Call* call,
+ const sem::ValueConversion* conv) {
if (!EmitType(out, conv->Target(), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) {
return false;
@@ -843,13 +843,13 @@
return true;
}
-bool GeneratorImpl::EmitTypeInitializer(std::ostream& out,
- const sem::Call* call,
- const sem::TypeInitializer* ctor) {
+bool GeneratorImpl::EmitValueConstructor(std::ostream& out,
+ const sem::Call* call,
+ const sem::ValueConstructor* ctor) {
auto* type = ctor->ReturnType();
- // If the type initializer is empty then we need to construct with the zero
- // value for all components.
+ // If the value constructor is empty then we need to construct with the zero value for all
+ // components.
if (call->Arguments().IsEmpty()) {
return EmitZeroValue(out, type);
}
diff --git a/src/tint/writer/glsl/generator_impl.h b/src/tint/writer/glsl/generator_impl.h
index 260852e..d220877 100644
--- a/src/tint/writer/glsl/generator_impl.h
+++ b/src/tint/writer/glsl/generator_impl.h
@@ -43,10 +43,10 @@
// Forward declarations
namespace tint::sem {
-class Call;
class Builtin;
-class TypeInitializer;
-class TypeConversion;
+class Call;
+class ValueConstructor;
+class ValueConversion;
} // namespace tint::sem
namespace tint::writer::glsl {
@@ -160,22 +160,22 @@
/// @param builtin the builtin being called
/// @returns true if the expression is emitted
bool EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin);
- /// Handles generating a type conversion expression
+ /// Handles generating a value conversion expression
/// @param out the output of the expression stream
/// @param call the call expression
- /// @param conv the type conversion
+ /// @param conv the value conversion
/// @returns true if the expression is emitted
- bool EmitTypeConversion(std::ostream& out,
- const sem::Call* call,
- const sem::TypeConversion* conv);
- /// Handles generating a type initializer expression
- /// @param out the output of the expression stream
- /// @param call the call expression
- /// @param ctor the type initializer
- /// @returns true if the expression is emitted
- bool EmitTypeInitializer(std::ostream& out,
+ bool EmitValueConversion(std::ostream& out,
const sem::Call* call,
- const sem::TypeInitializer* ctor);
+ const sem::ValueConversion* conv);
+ /// Handles generating a value constructor expression
+ /// @param out the output of the expression stream
+ /// @param call the call expression
+ /// @param ctor the value constructor
+ /// @returns true if the expression is emitted
+ bool EmitValueConstructor(std::ostream& out,
+ const sem::Call* call,
+ const sem::ValueConstructor* ctor);
/// Handles generating a barrier builtin call
/// @param out the output of the expression stream
/// @param builtin the semantic information for the barrier builtin
diff --git a/src/tint/writer/glsl/generator_impl_initializer_test.cc b/src/tint/writer/glsl/generator_impl_constructor_test.cc
similarity index 77%
rename from src/tint/writer/glsl/generator_impl_initializer_test.cc
rename to src/tint/writer/glsl/generator_impl_constructor_test.cc
index d62942d..2f4b3d0 100644
--- a/src/tint/writer/glsl/generator_impl_initializer_test.cc
+++ b/src/tint/writer/glsl/generator_impl_constructor_test.cc
@@ -22,9 +22,9 @@
using ::testing::HasSubstr;
-using GlslGeneratorImplTest_Initializer = TestHelper;
+using GlslGeneratorImplTest_Constructor = TestHelper;
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Bool) {
+TEST_F(GlslGeneratorImplTest_Constructor, Bool) {
WrapInFunction(Expr(false));
GeneratorImpl& gen = Build();
@@ -33,7 +33,7 @@
EXPECT_THAT(gen.result(), HasSubstr("false"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Int) {
+TEST_F(GlslGeneratorImplTest_Constructor, Int) {
WrapInFunction(Expr(-12345_i));
GeneratorImpl& gen = Build();
@@ -42,7 +42,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_UInt) {
+TEST_F(GlslGeneratorImplTest_Constructor, UInt) {
WrapInFunction(Expr(56779_u));
GeneratorImpl& gen = Build();
@@ -51,7 +51,7 @@
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Float) {
+TEST_F(GlslGeneratorImplTest_Constructor, Float) {
// Use a number close to 1<<30 but whose decimal representation ends in 0.
WrapInFunction(Expr(f32((1 << 30) - 4)));
@@ -61,7 +61,7 @@
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_F16) {
+TEST_F(GlslGeneratorImplTest_Constructor, F16) {
Enable(builtin::Extension::kF16);
// Use a number close to 1<<16 but whose decimal representation ends in 0.
@@ -73,7 +73,7 @@
EXPECT_THAT(gen.result(), HasSubstr("32752.0hf"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Float) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Float) {
WrapInFunction(Call<f32>(-1.2e-5_f));
GeneratorImpl& gen = Build();
@@ -82,7 +82,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-0.000012f"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(Call<f16>(-1.2e-3_h));
@@ -93,7 +93,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-0.00119972229hf"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Bool) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Bool) {
WrapInFunction(Call<bool>(true));
GeneratorImpl& gen = Build();
@@ -102,7 +102,7 @@
EXPECT_THAT(gen.result(), HasSubstr("true"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Int) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Int) {
WrapInFunction(Call<i32>(-12345_i));
GeneratorImpl& gen = Build();
@@ -111,7 +111,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Uint) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Uint) {
WrapInFunction(Call<u32>(12345_u));
GeneratorImpl& gen = Build();
@@ -120,7 +120,7 @@
EXPECT_THAT(gen.result(), HasSubstr("12345u"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F32) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_F32) {
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
GeneratorImpl& gen = Build();
@@ -129,7 +129,7 @@
EXPECT_THAT(gen.result(), HasSubstr("vec3(1.0f, 2.0f, 3.0f)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
@@ -140,7 +140,7 @@
EXPECT_THAT(gen.result(), HasSubstr("f16vec3(1.0hf, 2.0hf, 3.0hf)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F32) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_Empty_F32) {
WrapInFunction(vec3<f32>());
GeneratorImpl& gen = Build();
@@ -149,7 +149,7 @@
EXPECT_THAT(gen.result(), HasSubstr("vec3(0.0f)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_Empty_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>());
@@ -160,7 +160,7 @@
EXPECT_THAT(gen.result(), HasSubstr("f16vec3(0.0hf)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F32_Literal) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Literal) {
WrapInFunction(vec3<f32>(2_f));
GeneratorImpl& gen = Build();
@@ -169,7 +169,7 @@
EXPECT_THAT(gen.result(), HasSubstr("vec3(2.0f)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Literal) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(2_h));
@@ -180,7 +180,7 @@
EXPECT_THAT(gen.result(), HasSubstr("f16vec3(2.0hf)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F32_Var) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Var) {
auto* var = Var("v", Expr(2_f));
auto* cast = vec3<f32>(var);
WrapInFunction(var, cast);
@@ -192,7 +192,7 @@
vec3 tint_symbol = vec3(v);)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Var) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Var) {
Enable(builtin::Extension::kF16);
auto* var = Var("v", Expr(2_h));
@@ -206,7 +206,7 @@
f16vec3 tint_symbol = f16vec3(v);)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_Bool) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Bool) {
WrapInFunction(vec3<bool>(true));
GeneratorImpl& gen = Build();
@@ -215,7 +215,7 @@
EXPECT_THAT(gen.result(), HasSubstr("bvec3(true)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_Int) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Int) {
WrapInFunction(vec3<i32>(2_i));
GeneratorImpl& gen = Build();
@@ -224,7 +224,7 @@
EXPECT_THAT(gen.result(), HasSubstr("ivec3(2)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_UInt) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_UInt) {
WrapInFunction(vec3<u32>(2_u));
GeneratorImpl& gen = Build();
@@ -233,7 +233,7 @@
EXPECT_THAT(gen.result(), HasSubstr("uvec3(2u)"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F32) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_F32) {
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
GeneratorImpl& gen = Build();
@@ -243,7 +243,7 @@
EXPECT_THAT(gen.result(), HasSubstr("mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(3.0f, 4.0f, 5.0f))"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h)));
@@ -256,7 +256,7 @@
HasSubstr("f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf))"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F32) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Complex_F32) {
// mat4x4<f32>(
// vec4<f32>(2.0f, 3.0f, 4.0f, 8.0f),
// vec4<f32>(),
@@ -270,10 +270,10 @@
auto* vector_identical_init =
vec4<f32>(vec4<f32>(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0))));
- auto* initializer = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
- vector_identical_init);
+ auto* ctor = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
+ vector_identical_init);
- WrapInFunction(initializer);
+ WrapInFunction(ctor);
GeneratorImpl& gen = Build();
@@ -283,7 +283,7 @@
"vec4(7.0f), vec4(42.0f, 21.0f, 6.0f, -5.0f))"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Complex_F16) {
// mat4x4<f16>(
// vec4<f16>(2.0h, 3.0h, 4.0h, 8.0h),
// vec4<f16>(),
@@ -299,10 +299,10 @@
auto* vector_identical_init =
vec4<f16>(vec4<f16>(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0))));
- auto* initializer = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
- vector_identical_init);
+ auto* ctor = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
+ vector_identical_init);
- WrapInFunction(initializer);
+ WrapInFunction(ctor);
GeneratorImpl& gen = Build();
@@ -313,7 +313,7 @@
"f16vec4(7.0hf), f16vec4(42.0hf, 21.0hf, 6.0hf, -5.0hf))"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F32) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Empty_F32) {
WrapInFunction(mat2x3<f32>());
GeneratorImpl& gen = Build();
@@ -323,7 +323,7 @@
EXPECT_THAT(gen.result(), HasSubstr("mat2x3 tint_symbol = mat2x3(vec3(0.0f), vec3(0.0f))"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Empty_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>());
@@ -336,7 +336,7 @@
HasSubstr("f16mat2x3 tint_symbol = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf))"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F32) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Identity_F32) {
// fn f() {
// var m_1: mat4x4<f32> = mat4x4<f32>();
// var m_2: mat4x4<f32> = mat4x4<f32>(m_1);
@@ -354,7 +354,7 @@
EXPECT_THAT(gen.result(), HasSubstr("mat4 m_2 = mat4(m_1);"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F16) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Identity_F16) {
// fn f() {
// var m_1: mat4x4<f16> = mat4x4<f16>();
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
@@ -374,7 +374,7 @@
EXPECT_THAT(gen.result(), HasSubstr("f16mat4 m_2 = f16mat4(m_1);"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Array) {
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
@@ -386,7 +386,7 @@
"vec3(7.0f, 8.0f, 9.0f))"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array_Empty) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Array_Empty) {
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u)));
GeneratorImpl& gen = Build();
@@ -395,7 +395,7 @@
EXPECT_THAT(gen.result(), HasSubstr("vec3[3](vec3(0.0f), vec3(0.0f), vec3(0.0f))"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Struct) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Struct) {
auto* str = Structure("S", utils::Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
@@ -410,7 +410,7 @@
EXPECT_THAT(gen.result(), HasSubstr("S(1, 2.0f, ivec3(3, 4, 5))"));
}
-TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Struct_Empty) {
+TEST_F(GlslGeneratorImplTest_Constructor, Type_Struct_Empty) {
auto* str = Structure("S", utils::Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc
index dbcd4b6..cce8c06 100644
--- a/src/tint/writer/hlsl/generator_impl.cc
+++ b/src/tint/writer/hlsl/generator_impl.cc
@@ -37,8 +37,8 @@
#include "src/tint/sem/statement.h"
#include "src/tint/sem/struct.h"
#include "src/tint/sem/switch_statement.h"
-#include "src/tint/sem/type_conversion.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/sem/variable.h"
#include "src/tint/transform/add_empty_entry_point.h"
#include "src/tint/transform/array_length_from_uniform.h"
@@ -876,10 +876,11 @@
auto* call = builder_.Sem().Get<sem::Call>(expr);
auto* target = call->Target();
return Switch(
- target, [&](const sem::Function* func) { return EmitFunctionCall(out, call, func); },
+ target, //
+ [&](const sem::Function* func) { return EmitFunctionCall(out, call, func); },
[&](const sem::Builtin* builtin) { return EmitBuiltinCall(out, call, builtin); },
- [&](const sem::TypeConversion* conv) { return EmitTypeConversion(out, call, conv); },
- [&](const sem::TypeInitializer* ctor) { return EmitTypeInitializer(out, call, ctor); },
+ [&](const sem::ValueConversion* conv) { return EmitValueConversion(out, call, conv); },
+ [&](const sem::ValueConstructor* ctor) { return EmitValueConstructor(out, call, ctor); },
[&](Default) {
TINT_ICE(Writer, diagnostics_) << "unhandled call target: " << target->TypeInfo().name;
return false;
@@ -1027,9 +1028,9 @@
return true;
}
-bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
- const sem::Call* call,
- const sem::TypeConversion* conv) {
+bool GeneratorImpl::EmitValueConversion(std::ostream& out,
+ const sem::Call* call,
+ const sem::ValueConversion* conv) {
if (!EmitType(out, conv->Target(), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) {
return false;
@@ -1044,13 +1045,13 @@
return true;
}
-bool GeneratorImpl::EmitTypeInitializer(std::ostream& out,
- const sem::Call* call,
- const sem::TypeInitializer* ctor) {
+bool GeneratorImpl::EmitValueConstructor(std::ostream& out,
+ const sem::Call* call,
+ const sem::ValueConstructor* ctor) {
auto* type = call->Type();
- // If the type initializer is empty then we need to construct with the zero
- // value for all components.
+ // If the value constructor arguments are empty then we need to construct with the zero value
+ // for all components.
if (call->Arguments().IsEmpty()) {
return EmitZeroValue(out, type);
}
diff --git a/src/tint/writer/hlsl/generator_impl.h b/src/tint/writer/hlsl/generator_impl.h
index abf1fcb..6db120c 100644
--- a/src/tint/writer/hlsl/generator_impl.h
+++ b/src/tint/writer/hlsl/generator_impl.h
@@ -43,10 +43,10 @@
// Forward declarations
namespace tint::sem {
-class Call;
class Builtin;
-class TypeInitializer;
-class TypeConversion;
+class Call;
+class ValueConstructor;
+class ValueConversion;
} // namespace tint::sem
namespace tint::writer::hlsl {
@@ -140,22 +140,22 @@
/// @param builtin the builtin being called
/// @returns true if the expression is emitted
bool EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin);
- /// Handles generating a type conversion expression
+ /// Handles generating a value conversion expression
/// @param out the output of the expression stream
/// @param call the call expression
- /// @param conv the type conversion
+ /// @param conv the value conversion
/// @returns true if the expression is emitted
- bool EmitTypeConversion(std::ostream& out,
- const sem::Call* call,
- const sem::TypeConversion* conv);
- /// Handles generating a type initializer expression
- /// @param out the output of the expression stream
- /// @param call the call expression
- /// @param ctor the type initializer
- /// @returns true if the expression is emitted
- bool EmitTypeInitializer(std::ostream& out,
+ bool EmitValueConversion(std::ostream& out,
const sem::Call* call,
- const sem::TypeInitializer* ctor);
+ const sem::ValueConversion* conv);
+ /// Handles generating a value constructor expression
+ /// @param out the output of the expression stream
+ /// @param call the call expression
+ /// @param ctor the value constructor
+ /// @returns true if the expression is emitted
+ bool EmitValueConstructor(std::ostream& out,
+ const sem::Call* call,
+ const sem::ValueConstructor* ctor);
/// Handles generating a call expression to a
/// transform::DecomposeMemoryAccess::Intrinsic for a uniform buffer
/// @param out the output of the expression stream
diff --git a/src/tint/writer/hlsl/generator_impl_initializer_test.cc b/src/tint/writer/hlsl/generator_impl_constructor_test.cc
similarity index 80%
rename from src/tint/writer/hlsl/generator_impl_initializer_test.cc
rename to src/tint/writer/hlsl/generator_impl_constructor_test.cc
index ebc206a..6cd264e 100644
--- a/src/tint/writer/hlsl/generator_impl_initializer_test.cc
+++ b/src/tint/writer/hlsl/generator_impl_constructor_test.cc
@@ -22,9 +22,9 @@
using ::testing::HasSubstr;
-using HlslGeneratorImplTest_Initializer = TestHelper;
+using HlslGeneratorImplTest_Constructor = TestHelper;
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Bool) {
+TEST_F(HlslGeneratorImplTest_Constructor, Bool) {
WrapInFunction(Expr(false));
GeneratorImpl& gen = Build();
@@ -33,7 +33,7 @@
EXPECT_THAT(gen.result(), HasSubstr("false"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Int) {
+TEST_F(HlslGeneratorImplTest_Constructor, Int) {
WrapInFunction(Expr(-12345_i));
GeneratorImpl& gen = Build();
@@ -42,7 +42,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_UInt) {
+TEST_F(HlslGeneratorImplTest_Constructor, UInt) {
WrapInFunction(Expr(56779_u));
GeneratorImpl& gen = Build();
@@ -51,7 +51,7 @@
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Float) {
+TEST_F(HlslGeneratorImplTest_Constructor, Float) {
// Use a number close to 1<<30 but whose decimal representation ends in 0.
WrapInFunction(Expr(f32((1 << 30) - 4)));
@@ -61,7 +61,7 @@
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_F16) {
+TEST_F(HlslGeneratorImplTest_Constructor, F16) {
Enable(builtin::Extension::kF16);
// Use a number close to 1<<16 but whose decimal representation ends in 0.
@@ -73,7 +73,7 @@
EXPECT_THAT(gen.result(), HasSubstr("float16_t(32752.0h)"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Float) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Float) {
WrapInFunction(Call<f32>(-1.2e-5_f));
GeneratorImpl& gen = Build();
@@ -82,7 +82,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-0.000012f"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(Call<f16>(-1.2e-3_h));
@@ -93,7 +93,7 @@
EXPECT_THAT(gen.result(), HasSubstr("float16_t(-0.00119972229h)"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Bool) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Bool) {
WrapInFunction(Call<bool>(true));
GeneratorImpl& gen = Build();
@@ -102,7 +102,7 @@
EXPECT_THAT(gen.result(), HasSubstr("true"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Int) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Int) {
WrapInFunction(Call<i32>(-12345_i));
GeneratorImpl& gen = Build();
@@ -111,7 +111,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Uint) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Uint) {
WrapInFunction(Call<u32>(12345_u));
GeneratorImpl& gen = Build();
@@ -120,7 +120,7 @@
EXPECT_THAT(gen.result(), HasSubstr("12345u"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F32) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_F32) {
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
GeneratorImpl& gen = Build();
@@ -129,7 +129,7 @@
EXPECT_THAT(gen.result(), HasSubstr("float3(1.0f, 2.0f, 3.0f)"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
@@ -142,7 +142,7 @@
HasSubstr("vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h))"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F32) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_Empty_F32) {
WrapInFunction(vec3<f32>());
GeneratorImpl& gen = Build();
@@ -151,7 +151,7 @@
EXPECT_THAT(gen.result(), HasSubstr("0.0f).xxx"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_Empty_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>());
@@ -162,7 +162,7 @@
EXPECT_THAT(gen.result(), HasSubstr("(float16_t(0.0h)).xxx"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F32_Literal) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Literal) {
WrapInFunction(vec3<f32>(2_f));
GeneratorImpl& gen = Build();
@@ -171,7 +171,7 @@
EXPECT_THAT(gen.result(), HasSubstr("2.0f).xxx"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Literal) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(2_h));
@@ -182,7 +182,7 @@
EXPECT_THAT(gen.result(), HasSubstr("(float16_t(2.0h)).xxx"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F32_Var) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Var) {
auto* var = Var("v", Expr(2_f));
auto* cast = vec3<f32>(var);
WrapInFunction(var, cast);
@@ -194,7 +194,7 @@
const float3 tint_symbol = float3((v).xxx);)"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Var) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Var) {
Enable(builtin::Extension::kF16);
auto* var = Var("v", Expr(2_h));
@@ -208,7 +208,7 @@
const vector<float16_t, 3> tint_symbol = vector<float16_t, 3>((v).xxx);)"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_Bool_Literal) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Bool_Literal) {
WrapInFunction(vec3<bool>(true));
GeneratorImpl& gen = Build();
@@ -217,7 +217,7 @@
EXPECT_THAT(gen.result(), HasSubstr("(true).xxx"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_Bool_Var) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Bool_Var) {
auto* var = Var("v", Expr(true));
auto* cast = vec3<bool>(var);
WrapInFunction(var, cast);
@@ -229,7 +229,7 @@
const bool3 tint_symbol = bool3((v).xxx);)"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_Int) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Int) {
WrapInFunction(vec3<i32>(2_i));
GeneratorImpl& gen = Build();
@@ -238,7 +238,7 @@
EXPECT_THAT(gen.result(), HasSubstr("2).xxx"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_UInt) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_UInt) {
WrapInFunction(vec3<u32>(2_u));
GeneratorImpl& gen = Build();
@@ -247,7 +247,7 @@
EXPECT_THAT(gen.result(), HasSubstr("2u).xxx"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F32) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_F32) {
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
GeneratorImpl& gen = Build();
@@ -258,7 +258,7 @@
HasSubstr("float2x3(float3(1.0f, 2.0f, 3.0f), float3(3.0f, 4.0f, 5.0f))"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h)));
@@ -273,7 +273,7 @@
"3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)))"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F32) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Complex_F32) {
// mat4x4<f32>(
// vec4<f32>(2.0f, 3.0f, 4.0f, 8.0f),
// vec4<f32>(),
@@ -287,10 +287,10 @@
auto* vector_identical_init =
vec4<f32>(vec4<f32>(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0))));
- auto* initializer = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
+ auto* constructor = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
vector_identical_init);
- WrapInFunction(initializer);
+ WrapInFunction(constructor);
GeneratorImpl& gen = Build();
@@ -300,7 +300,7 @@
"(7.0f).xxxx, float4(42.0f, 21.0f, 6.0f, -5.0f))"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Complex_F16) {
// mat4x4<f16>(
// vec4<f16>(2.0h, 3.0h, 4.0h, 8.0h),
// vec4<f16>(),
@@ -316,10 +316,10 @@
auto* vector_identical_init =
vec4<f16>(vec4<f16>(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0))));
- auto* initializer = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
+ auto* constructor = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
vector_identical_init);
- WrapInFunction(initializer);
+ WrapInFunction(constructor);
GeneratorImpl& gen = Build();
@@ -333,7 +333,7 @@
"float16_t(6.0h), float16_t(-5.0h)))"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F32) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Empty_F32) {
WrapInFunction(mat2x3<f32>());
GeneratorImpl& gen = Build();
@@ -343,7 +343,7 @@
EXPECT_THAT(gen.result(), HasSubstr("float2x3 tint_symbol = float2x3((0.0f).xxx, (0.0f).xxx)"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Empty_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>());
@@ -356,7 +356,7 @@
HasSubstr("matrix<float16_t, 2, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F32) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Identity_F32) {
// fn f() {
// var m_1: mat4x4<f32> = mat4x4<f32>();
// var m_2: mat4x4<f32> = mat4x4<f32>(m_1);
@@ -374,7 +374,7 @@
EXPECT_THAT(gen.result(), HasSubstr("float4x4 m_2 = float4x4(m_1);"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F16) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Identity_F16) {
// fn f() {
// var m_1: mat4x4<f16> = mat4x4<f16>();
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
@@ -395,7 +395,7 @@
HasSubstr("matrix<float16_t, 4, 4> m_2 = matrix<float16_t, 4, 4>(m_1);"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Array) {
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
@@ -406,7 +406,7 @@
" float3(7.0f, 8.0f, 9.0f)}"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array_Empty) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Array_Empty) {
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u)));
GeneratorImpl& gen = Build();
@@ -415,7 +415,7 @@
EXPECT_THAT(gen.result(), HasSubstr("(float3[3])0"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Struct) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Struct) {
auto* str = Structure("S", utils::Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
@@ -430,7 +430,7 @@
EXPECT_THAT(gen.result(), HasSubstr("{1, 2.0f, int3(3, 4, 5)}"));
}
-TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Struct_Empty) {
+TEST_F(HlslGeneratorImplTest_Constructor, Type_Struct_Empty) {
auto* str = Structure("S", utils::Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc
index d401cd2..c433207 100644
--- a/src/tint/writer/msl/generator_impl.cc
+++ b/src/tint/writer/msl/generator_impl.cc
@@ -37,8 +37,8 @@
#include "src/tint/sem/module.h"
#include "src/tint/sem/struct.h"
#include "src/tint/sem/switch_statement.h"
-#include "src/tint/sem/type_conversion.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/sem/variable.h"
#include "src/tint/transform/array_length_from_uniform.h"
#include "src/tint/transform/builtin_polyfill.h"
@@ -640,8 +640,8 @@
return Switch(
target, [&](const sem::Function* func) { return EmitFunctionCall(out, call, func); },
[&](const sem::Builtin* builtin) { return EmitBuiltinCall(out, call, builtin); },
- [&](const sem::TypeConversion* conv) { return EmitTypeConversion(out, call, conv); },
- [&](const sem::TypeInitializer* ctor) { return EmitTypeInitializer(out, call, ctor); },
+ [&](const sem::ValueConversion* conv) { return EmitTypeConversion(out, call, conv); },
+ [&](const sem::ValueConstructor* ctor) { return EmitTypeInitializer(out, call, ctor); },
[&](Default) {
TINT_ICE(Writer, diagnostics_) << "unhandled call target: " << target->TypeInfo().name;
return false;
@@ -785,7 +785,7 @@
bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
const sem::Call* call,
- const sem::TypeConversion* conv) {
+ const sem::ValueConversion* conv) {
if (!EmitType(out, conv->Target(), "")) {
return false;
}
@@ -801,7 +801,7 @@
bool GeneratorImpl::EmitTypeInitializer(std::ostream& out,
const sem::Call* call,
- const sem::TypeInitializer* ctor) {
+ const sem::ValueConstructor* ctor) {
auto* type = ctor->ReturnType();
const char* terminator = ")";
diff --git a/src/tint/writer/msl/generator_impl.h b/src/tint/writer/msl/generator_impl.h
index 57c129b..9c7c0d4 100644
--- a/src/tint/writer/msl/generator_impl.h
+++ b/src/tint/writer/msl/generator_impl.h
@@ -46,10 +46,10 @@
// Forward declarations
namespace tint::sem {
-class Call;
class Builtin;
-class TypeInitializer;
-class TypeConversion;
+class Call;
+class ValueConstructor;
+class ValueConversion;
} // namespace tint::sem
namespace tint::writer::msl {
@@ -144,22 +144,22 @@
/// @param builtin the builtin being called
/// @returns true if the call expression is emitted
bool EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin);
- /// Handles generating a type conversion expression
+ /// Handles generating a value conversion expression
/// @param out the output of the expression stream
/// @param call the call expression
- /// @param conv the type conversion
+ /// @param conv the value conversion
/// @returns true if the expression is emitted
bool EmitTypeConversion(std::ostream& out,
const sem::Call* call,
- const sem::TypeConversion* conv);
- /// Handles generating a type initializer
+ const sem::ValueConversion* conv);
+ /// Handles generating a value constructor
/// @param out the output of the expression stream
/// @param call the call expression
- /// @param ctor the type initializer
+ /// @param ctor the value constructor
/// @returns true if the initializer is emitted
bool EmitTypeInitializer(std::ostream& out,
const sem::Call* call,
- const sem::TypeInitializer* ctor);
+ const sem::ValueConstructor* ctor);
/// Handles generating a function call
/// @param out the output of the expression stream
/// @param call the call expression
diff --git a/src/tint/writer/msl/generator_impl_initializer_test.cc b/src/tint/writer/msl/generator_impl_constructor_test.cc
similarity index 82%
rename from src/tint/writer/msl/generator_impl_initializer_test.cc
rename to src/tint/writer/msl/generator_impl_constructor_test.cc
index fbd1def..ba567ab 100644
--- a/src/tint/writer/msl/generator_impl_initializer_test.cc
+++ b/src/tint/writer/msl/generator_impl_constructor_test.cc
@@ -22,9 +22,9 @@
using ::testing::HasSubstr;
-using MslGeneratorImplTest = TestHelper;
+using MslGeneratorImplTest_Constructor = TestHelper;
-TEST_F(MslGeneratorImplTest, EmitInitializer_Bool) {
+TEST_F(MslGeneratorImplTest_Constructor, Bool) {
WrapInFunction(Expr(false));
GeneratorImpl& gen = Build();
@@ -33,7 +33,7 @@
EXPECT_THAT(gen.result(), HasSubstr("false"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Int) {
+TEST_F(MslGeneratorImplTest_Constructor, Int) {
WrapInFunction(Expr(-12345_i));
GeneratorImpl& gen = Build();
@@ -42,7 +42,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_UInt) {
+TEST_F(MslGeneratorImplTest_Constructor, UInt) {
WrapInFunction(Expr(56779_u));
GeneratorImpl& gen = Build();
@@ -51,7 +51,7 @@
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Float) {
+TEST_F(MslGeneratorImplTest_Constructor, Float) {
// Use a number close to 1<<30 but whose decimal representation ends in 0.
WrapInFunction(Expr(f32((1 << 30) - 4)));
@@ -61,7 +61,7 @@
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_F16) {
+TEST_F(MslGeneratorImplTest_Constructor, F16) {
Enable(builtin::Extension::kF16);
// Use a number close to 1<<16 but whose decimal representation ends in 0.
@@ -73,7 +73,7 @@
EXPECT_THAT(gen.result(), HasSubstr("32752.0h"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Float) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Float) {
WrapInFunction(Call<f32>(-1.2e-5_f));
GeneratorImpl& gen = Build();
@@ -82,7 +82,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-0.000012f"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_F16) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(Call<f16>(-1.2e-3_h));
@@ -93,7 +93,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-0.00119972229h"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Bool) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Bool) {
WrapInFunction(Call<bool>(true));
GeneratorImpl& gen = Build();
@@ -102,7 +102,7 @@
EXPECT_THAT(gen.result(), HasSubstr("true"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Int) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Int) {
WrapInFunction(Call<i32>(-12345_i));
GeneratorImpl& gen = Build();
@@ -111,7 +111,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Uint) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Uint) {
WrapInFunction(Call<u32>(12345_u));
GeneratorImpl& gen = Build();
@@ -120,7 +120,7 @@
EXPECT_THAT(gen.result(), HasSubstr("12345u"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F32) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_F32) {
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
GeneratorImpl& gen = Build();
@@ -129,7 +129,7 @@
EXPECT_THAT(gen.result(), HasSubstr("float3(1.0f, 2.0f, 3.0f)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F16) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
@@ -140,7 +140,7 @@
EXPECT_THAT(gen.result(), HasSubstr("half3(1.0h, 2.0h, 3.0h)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F32) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_Empty_F32) {
WrapInFunction(vec3<f32>());
GeneratorImpl& gen = Build();
@@ -149,7 +149,7 @@
EXPECT_THAT(gen.result(), HasSubstr("float3(0.0f)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F16) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_Empty_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>());
@@ -160,7 +160,7 @@
EXPECT_THAT(gen.result(), HasSubstr("half3(0.0h)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F32_Literal) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Literal) {
WrapInFunction(vec3<f32>(2_f));
GeneratorImpl& gen = Build();
@@ -169,7 +169,7 @@
EXPECT_THAT(gen.result(), HasSubstr("float3(2.0f)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Literal) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(2_h));
@@ -180,7 +180,7 @@
EXPECT_THAT(gen.result(), HasSubstr("half3(2.0h)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F32_Var) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Var) {
auto* var = Var("v", Expr(2_f));
auto* cast = vec3<f32>(var);
WrapInFunction(var, cast);
@@ -192,7 +192,7 @@
float3 const tint_symbol = float3(v);)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Var) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Var) {
Enable(builtin::Extension::kF16);
auto* var = Var("v", Expr(2_h));
@@ -206,7 +206,7 @@
half3 const tint_symbol = half3(v);)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_Bool) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Bool) {
WrapInFunction(vec3<bool>(true));
GeneratorImpl& gen = Build();
@@ -215,7 +215,7 @@
EXPECT_THAT(gen.result(), HasSubstr("bool3(true)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_Int) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Int) {
WrapInFunction(vec3<i32>(2_i));
GeneratorImpl& gen = Build();
@@ -224,7 +224,7 @@
EXPECT_THAT(gen.result(), HasSubstr("int3(2)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_UInt) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_UInt) {
WrapInFunction(vec3<u32>(2_u));
GeneratorImpl& gen = Build();
@@ -233,7 +233,7 @@
EXPECT_THAT(gen.result(), HasSubstr("uint3(2u)"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F32) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_F32) {
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
GeneratorImpl& gen = Build();
@@ -244,7 +244,7 @@
HasSubstr("float2x3(float3(1.0f, 2.0f, 3.0f), float3(3.0f, 4.0f, 5.0f))"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F16) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h)));
@@ -257,7 +257,7 @@
HasSubstr("half2x3(half3(1.0h, 2.0h, 3.0h), half3(3.0h, 4.0h, 5.0h))"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Complex_F32) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Complex_F32) {
// mat4x4<f32>(
// vec4<f32>(2.0f, 3.0f, 4.0f, 8.0f),
// vec4<f32>(),
@@ -271,10 +271,10 @@
auto* vector_identical_init =
vec4<f32>(vec4<f32>(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0))));
- auto* initializer = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
+ auto* constructor = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
vector_identical_init);
- WrapInFunction(initializer);
+ WrapInFunction(constructor);
GeneratorImpl& gen = Build();
@@ -284,7 +284,7 @@
"float4(7.0f), float4(42.0f, 21.0f, 6.0f, -5.0f))"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Complex_F16) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Complex_F16) {
// mat4x4<f16>(
// vec4<f16>(2.0h, 3.0h, 4.0h, 8.0h),
// vec4<f16>(),
@@ -300,10 +300,10 @@
auto* vector_identical_init =
vec4<f16>(vec4<f16>(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0))));
- auto* initializer = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
+ auto* constructor = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
vector_identical_init);
- WrapInFunction(initializer);
+ WrapInFunction(constructor);
GeneratorImpl& gen = Build();
@@ -313,7 +313,7 @@
"half4(7.0h), half4(42.0h, 21.0h, 6.0h, -5.0h))"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F32) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Empty_F32) {
WrapInFunction(mat2x3<f32>());
GeneratorImpl& gen = Build();
@@ -324,7 +324,7 @@
HasSubstr("float2x3 const tint_symbol = float2x3(float3(0.0f), float3(0.0f))"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F16) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Empty_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>());
@@ -337,7 +337,7 @@
HasSubstr("half2x3 const tint_symbol = half2x3(half3(0.0h), half3(0.0h))"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Identity_F32) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Identity_F32) {
// fn f() {
// var m_1: mat4x4<f32> = mat4x4<f32>();
// var m_2: mat4x4<f32> = mat4x4<f32>(m_1);
@@ -355,7 +355,7 @@
EXPECT_THAT(gen.result(), HasSubstr("float4x4 m_2 = float4x4(m_1);"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Identity_F16) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Identity_F16) {
// fn f() {
// var m_1: mat4x4<f16> = mat4x4<f16>();
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
@@ -375,7 +375,7 @@
EXPECT_THAT(gen.result(), HasSubstr("half4x4 m_2 = half4x4(m_1);"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Array) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Array) {
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
@@ -386,7 +386,7 @@
"float3(7.0f, 8.0f, 9.0f)}"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Struct) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Struct) {
auto* str = Structure("S", utils::Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
@@ -401,7 +401,7 @@
EXPECT_THAT(gen.result(), HasSubstr("{.a=1, .b=2.0f, .c=int3(3, 4, 5)}"));
}
-TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Struct_Empty) {
+TEST_F(MslGeneratorImplTest_Constructor, Type_Struct_Empty) {
auto* str = Structure("S", utils::Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc
index 9c85bc1..ad0d746 100644
--- a/src/tint/writer/spirv/builder.cc
+++ b/src/tint/writer/spirv/builder.cc
@@ -33,8 +33,8 @@
#include "src/tint/sem/statement.h"
#include "src/tint/sem/struct.h"
#include "src/tint/sem/switch_statement.h"
-#include "src/tint/sem/type_conversion.h"
-#include "src/tint/sem/type_initializer.h"
+#include "src/tint/sem/value_constructor.h"
+#include "src/tint/sem/value_conversion.h"
#include "src/tint/sem/variable.h"
#include "src/tint/transform/add_block_attribute.h"
#include "src/tint/type/array.h"
@@ -770,7 +770,7 @@
uint32_t init_id = 0;
if (auto* ctor = v->initializer) {
- init_id = GenerateInitializerExpression(v, ctor);
+ init_id = GenerateConstructorExpression(v, ctor);
if (init_id == 0) {
return false;
}
@@ -1247,7 +1247,7 @@
return id;
}
-uint32_t Builder::GenerateInitializerExpression(const ast::Variable* var,
+uint32_t Builder::GenerateConstructorExpression(const ast::Variable* var,
const ast::Expression* expr) {
if (auto* sem = builder_.Sem().GetVal(expr)) {
if (auto constant = sem->ConstantValue()) {
@@ -1255,15 +1255,15 @@
}
}
if (auto* call = builder_.Sem().Get<sem::Call>(expr)) {
- if (call->Target()->IsAnyOf<sem::TypeInitializer, sem::TypeConversion>()) {
- return GenerateTypeInitializerOrConversion(call, var);
+ if (call->Target()->IsAnyOf<sem::ValueConstructor, sem::ValueConversion>()) {
+ return GenerateValueConstructorOrConversion(call, var);
}
}
- error_ = "unknown initializer expression";
+ error_ = "unknown constructor expression";
return 0;
}
-bool Builder::IsInitializerConst(const ast::Expression* expr) {
+bool Builder::IsConstructorConst(const ast::Expression* expr) {
bool is_const = true;
ast::TraverseExpressions(expr, builder_.Diagnostics(), [&](const ast::Expression* e) {
if (e->Is<ast::LiteralExpression>()) {
@@ -1277,7 +1277,7 @@
return ast::TraverseAction::Skip;
}
auto* call = sem->As<sem::Call>();
- if (call->Target()->Is<sem::TypeInitializer>()) {
+ if (call->Target()->Is<sem::ValueConstructor>()) {
return ast::TraverseAction::Descend;
}
}
@@ -1288,19 +1288,19 @@
return is_const;
}
-uint32_t Builder::GenerateTypeInitializerOrConversion(const sem::Call* call,
- const ast::Variable* var) {
+uint32_t Builder::GenerateValueConstructorOrConversion(const sem::Call* call,
+ const ast::Variable* var) {
auto& args = call->Arguments();
auto* global_var = builder_.Sem().Get<sem::GlobalVariable>(var);
auto* result_type = call->Type();
- // Generate the zero initializer if there are no values provided.
+ // Generate the zero constructor if there are no values provided.
if (args.IsEmpty()) {
return GenerateConstantNullIfNeeded(result_type->UnwrapRef());
}
result_type = result_type->UnwrapRef();
- bool initializer_is_const = IsInitializerConst(call->Declaration());
+ bool constructor_is_const = IsConstructorConst(call->Declaration());
if (has_error()) {
return 0;
}
@@ -1335,7 +1335,7 @@
return 0;
}
- bool result_is_constant_composite = initializer_is_const;
+ bool result_is_constant_composite = constructor_is_const;
bool result_is_spec_composite = false;
if (auto* vec = result_type->As<type::Vector>()) {
@@ -2243,13 +2243,14 @@
auto* call = builder_.Sem().Get<sem::Call>(expr);
auto* target = call->Target();
return Switch(
- target, [&](const sem::Function* func) { return GenerateFunctionCall(call, func); },
+ target, //
+ [&](const sem::Function* func) { return GenerateFunctionCall(call, func); },
[&](const sem::Builtin* builtin) { return GenerateBuiltinCall(call, builtin); },
- [&](const sem::TypeConversion*) {
- return GenerateTypeInitializerOrConversion(call, nullptr);
+ [&](const sem::ValueConversion*) {
+ return GenerateValueConstructorOrConversion(call, nullptr);
},
- [&](const sem::TypeInitializer*) {
- return GenerateTypeInitializerOrConversion(call, nullptr);
+ [&](const sem::ValueConstructor*) {
+ return GenerateValueConstructorOrConversion(call, nullptr);
},
[&](Default) {
TINT_ICE(Writer, builder_.Diagnostics())
diff --git a/src/tint/writer/spirv/builder.h b/src/tint/writer/spirv/builder.h
index adfe659..53fb108 100644
--- a/src/tint/writer/spirv/builder.h
+++ b/src/tint/writer/spirv/builder.h
@@ -45,8 +45,8 @@
namespace tint::sem {
class Call;
class Load;
-class TypeInitializer;
-class TypeConversion;
+class ValueConstructor;
+class ValueConversion;
} // namespace tint::sem
namespace tint::type {
class Reference;
@@ -338,11 +338,11 @@
/// instruction set, if one doesn't exist yet, and returns the import ID.
/// @returns the import ID, or 0 on error.
uint32_t GetGLSLstd450Import();
- /// Generates a initializer expression
+ /// Generates a constructor expression
/// @param var the variable generated for, nullptr if no variable associated.
/// @param expr the expression to generate
/// @returns the ID of the expression or 0 on failure.
- uint32_t GenerateInitializerExpression(const ast::Variable* var, const ast::Expression* expr);
+ uint32_t GenerateConstructorExpression(const ast::Variable* var, const ast::Expression* expr);
/// Generates a literal constant if needed
/// @param lit the literal to generate
/// @returns the ID on success or 0 on failure
@@ -373,11 +373,11 @@
/// @param builtin the builtin being called
/// @returns the expression ID on success or 0 otherwise
uint32_t GenerateBuiltinCall(const sem::Call* call, const sem::Builtin* builtin);
- /// Handles generating a type initializer or type conversion expression
+ /// Handles generating a value constructor or value conversion expression
/// @param call the call expression
/// @param var the variable that is being initialized. May be null.
/// @returns the expression ID on success or 0 otherwise
- uint32_t GenerateTypeInitializerOrConversion(const sem::Call* call, const ast::Variable* var);
+ uint32_t GenerateValueConstructorOrConversion(const sem::Call* call, const ast::Variable* var);
/// Generates a texture builtin call. Emits an error and returns false if
/// we're currently outside a function.
/// @param call the call expression
@@ -538,10 +538,10 @@
/// @returns SPIR-V image format type
SpvImageFormat convert_texel_format_to_spv(const builtin::TexelFormat format);
- /// Determines if the given type initializer is created from constant values
+ /// Determines if the given value constructor is created from constant values
/// @param expr the expression to check
- /// @returns true if the initializer is constant
- bool IsInitializerConst(const ast::Expression* expr);
+ /// @returns true if the constructor is constant
+ bool IsConstructorConst(const ast::Expression* expr);
private:
/// @returns an Operand with a new result ID in it. Increments the next_id_
diff --git a/src/tint/writer/spirv/builder_initializer_expression_test.cc b/src/tint/writer/spirv/builder_constructor_expression_test.cc
similarity index 88%
rename from src/tint/writer/spirv/builder_initializer_expression_test.cc
rename to src/tint/writer/spirv/builder_constructor_expression_test.cc
index cf382e0..29a47ac 100644
--- a/src/tint/writer/spirv/builder_initializer_expression_test.cc
+++ b/src/tint/writer/spirv/builder_constructor_expression_test.cc
@@ -20,15 +20,15 @@
namespace tint::writer::spirv {
namespace {
-using SpvBuilderInitializerTest = TestHelper;
+using SpvBuilderConstructorTest = TestHelper;
-TEST_F(SpvBuilderInitializerTest, Const) {
+TEST_F(SpvBuilderConstructorTest, Const) {
auto* c = Expr(42.2_f);
auto* g = GlobalVar("g", ty.f32(), c, builtin::AddressSpace::kPrivate);
spirv::Builder& b = Build();
- EXPECT_EQ(b.GenerateInitializerExpression(g, c), 2u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, c), 2u);
ASSERT_FALSE(b.has_error()) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32
@@ -36,13 +36,13 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type) {
+TEST_F(SpvBuilderConstructorTest, Type) {
auto* t = vec3<f32>(1_f, 1_f, 3_f);
WrapInFunction(t);
spirv::Builder& b = Build();
- EXPECT_EQ(b.GenerateInitializerExpression(nullptr, t), 5u);
+ EXPECT_EQ(b.GenerateConstructorExpression(nullptr, t), 5u);
ASSERT_FALSE(b.has_error()) << b.error();
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
@@ -53,7 +53,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_WithCasts) {
+TEST_F(SpvBuilderConstructorTest, Type_WithCasts) {
auto* t = vec2<f32>(Call<f32>(1_i), Call<f32>(1_i));
WrapInFunction(t);
@@ -72,7 +72,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_WithAlias) {
+TEST_F(SpvBuilderConstructorTest, Type_WithAlias) {
// type Int = i32
// cast<Int>(2.3f)
@@ -91,7 +91,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_IdentifierExpression_Param) {
+TEST_F(SpvBuilderConstructorTest, Type_IdentifierExpression_Param) {
auto* var = Var("ident", ty.f32());
auto* t = vec2<f32>(1_f, "ident");
@@ -121,7 +121,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Vector_Bitcast_Params) {
+TEST_F(SpvBuilderConstructorTest, Vector_Bitcast_Params) {
auto* var = Var("v", vec3<f32>(1_f, 2_f, 3_f));
auto* cast = Bitcast(ty.vec3<u32>(), var);
WrapInFunction(var, cast);
@@ -150,7 +150,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Bool_With_Bool) {
+TEST_F(SpvBuilderConstructorTest, Type_Bool_With_Bool) {
auto* cast = Call<bool>(true);
WrapInFunction(cast);
@@ -167,7 +167,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_I32_With_I32) {
+TEST_F(SpvBuilderConstructorTest, Type_I32_With_I32) {
auto* cast = Call<i32>(2_i);
WrapInFunction(cast);
@@ -182,7 +182,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_U32_With_U32) {
+TEST_F(SpvBuilderConstructorTest, Type_U32_With_U32) {
auto* cast = Call<u32>(2_u);
WrapInFunction(cast);
@@ -197,7 +197,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_F32_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_F32_With_F32) {
auto* cast = Call<f32>(2_f);
WrapInFunction(cast);
@@ -212,7 +212,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_F16_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_F16_With_F16) {
Enable(builtin::Extension::kF16);
auto* cast = Call<f16>(2_h);
@@ -229,7 +229,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_Bool_Literal) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_Bool_Literal) {
auto* cast = vec2<bool>(true);
WrapInFunction(cast);
@@ -246,7 +246,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_Bool_Var) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_Bool_Var) {
auto* var = Var("v", Expr(true));
auto* cast = vec2<bool>(var);
WrapInFunction(var, cast);
@@ -270,7 +270,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F32_Literal) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F32_Literal) {
auto* cast = vec2<f32>(2_f);
WrapInFunction(cast);
@@ -287,7 +287,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_Literal) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F16_Literal) {
Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(2_h);
@@ -306,7 +306,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F32_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F32_F32) {
auto* var = Decl(Var("x", ty.f32(), Expr(2_f)));
auto* cast = vec2<f32>("x", "x");
WrapInFunction(var, cast);
@@ -331,7 +331,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F16_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
@@ -358,7 +358,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F32_F32_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F32_F32_Const) {
auto* cast = vec2<f32>(1_f, 2_f);
WrapInFunction(cast);
@@ -376,7 +376,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_F16_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F16_F16_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(1_h, 2_h);
@@ -396,7 +396,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_F32_With_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_F32_With_Vec2) {
auto* var = Decl(Var("x", ty.vec2<f32>(), vec2<f32>(1_f, 2_f)));
auto* cast = vec2<f32>("x");
WrapInFunction(var, cast);
@@ -421,7 +421,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_F16_With_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_F16_With_Vec2) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h)));
@@ -448,7 +448,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_F32_With_Vec2_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_F32_With_Vec2_Const) {
auto* cast = vec2<f32>(vec2<f32>(1_f, 2_f));
WrapInFunction(cast);
@@ -466,7 +466,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec2_F16_With_Vec2_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec2_F16_With_Vec2_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(vec2<f16>(1_h, 2_h));
@@ -486,7 +486,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32) {
auto* var = Decl(Var("x", ty.f32(), Expr(2_f)));
auto* cast = vec3<f32>("x", "x", "x");
WrapInFunction(var, cast);
@@ -512,7 +512,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
@@ -540,7 +540,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_Const) {
auto* cast = vec3<f32>(1_f, 2_f, 3_f);
WrapInFunction(cast);
@@ -559,7 +559,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(1_h, 2_h, 3_h);
@@ -580,7 +580,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Bool) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Bool) {
auto* var = Decl(Var("x", ty.bool_(), Expr(true)));
auto* cast = vec3<bool>("x", "x", "x");
WrapInFunction(var, cast);
@@ -606,7 +606,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Bool_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Bool_Const) {
auto* cast = vec3<bool>(true, false, true);
WrapInFunction(cast);
@@ -624,7 +624,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_F32_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_F32_F32) {
auto* var = Decl(Var("x", ty.f32(), Expr(2_f)));
auto* cast = vec3<f32>("x", "x", "x");
WrapInFunction(var, cast);
@@ -650,7 +650,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_F16_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16_F16_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
@@ -678,7 +678,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_F32_F32_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_F32_F32_Const) {
auto* cast = vec3<f32>(1_f, 2_f, 3_f);
WrapInFunction(cast);
@@ -697,7 +697,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_F16_F16_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16_F16_F16_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(1_h, 2_h, 3_h);
@@ -718,7 +718,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_Vec2) {
auto* var = Decl(Var("x", ty.vec2<f32>(), vec2<f32>(2_f, 3_f)));
auto* cast = vec3<f32>(1_f, "x");
WrapInFunction(var, cast);
@@ -748,7 +748,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16_Vec2) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(2_h, 3_h)));
@@ -780,7 +780,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_Vec2_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_Vec2_Const) {
auto* cast = vec3<f32>(1_f, vec2<f32>(2_f, 3_f));
WrapInFunction(cast);
@@ -799,7 +799,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Vec2_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16_Vec2_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(1_h, vec2<f16>(2_h, 3_h));
@@ -820,7 +820,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec2_F32) {
auto* var = Decl(Var("x", ty.vec2<f32>(), vec2<f32>(1_f, 2_f)));
auto* cast = vec3<f32>("x", 3_f);
WrapInFunction(var, cast);
@@ -850,7 +850,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec2_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h)));
@@ -882,7 +882,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F32_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec2_F32_Const) {
auto* cast = vec3<f32>(vec2<f32>(1_f, 2_f), 3_f);
WrapInFunction(cast);
@@ -901,7 +901,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F16_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec2_F16_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec2<f16>(1_h, 2_h), 3_h);
@@ -922,7 +922,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_F32_With_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_F32_With_Vec3) {
auto* var = Decl(Var("x", ty.vec3<f32>(), vec3<f32>(1_f, 2_f, 3_f)));
auto* cast = vec3<f32>("x");
WrapInFunction(var, cast);
@@ -948,7 +948,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_F16_With_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_F16_With_Vec3) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec3<f16>(), vec3<f16>(1_h, 2_h, 3_h)));
@@ -976,7 +976,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_F32_With_Vec3_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_F32_With_Vec3_Const) {
auto* cast = vec3<f32>(vec3<f32>(1_f, 2_f, 3_f));
WrapInFunction(cast);
@@ -995,7 +995,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec3_F16_With_Vec3_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec3_F16_With_Vec3_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec3<f16>(1_h, 2_h, 3_h));
@@ -1016,7 +1016,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Bool) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Bool) {
auto* var = Decl(Var("x", ty.bool_(), Expr(true)));
auto* cast = vec4<bool>("x");
WrapInFunction(var, cast);
@@ -1040,7 +1040,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Bool_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Bool_Const) {
auto* cast = vec4<bool>(true);
WrapInFunction(cast);
@@ -1057,7 +1057,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32) {
auto* var = Decl(Var("x", ty.f32(), Expr(2_f)));
auto* cast = vec4<f32>("x");
WrapInFunction(var, cast);
@@ -1081,7 +1081,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
@@ -1107,7 +1107,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Const) {
auto* cast = vec4<f32>(2_f);
WrapInFunction(cast);
@@ -1124,7 +1124,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h);
@@ -1143,7 +1143,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_F32_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_F32_F32_F32) {
auto* var = Decl(Var("x", ty.f32(), Expr(2_f)));
auto* cast = vec4<f32>("x", "x", "x", "x");
WrapInFunction(var, cast);
@@ -1170,7 +1170,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_F16_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_F16_F16_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
@@ -1199,7 +1199,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_F32_F32_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_F32_F32_F32_Const) {
auto* cast = vec4<f32>(1_f, 2_f, 3_f, 4_f);
WrapInFunction(cast);
@@ -1219,7 +1219,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_F16_F16_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_F16_F16_F16_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(1_h, 2_h, 3_h, 4_h);
@@ -1241,7 +1241,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_F32_Vec2) {
auto* var = Decl(Var("x", ty.vec2<f32>(), vec2<f32>(1_f, 2_f)));
auto* cast = vec4<f32>(1_f, 2_f, "x");
WrapInFunction(var, cast);
@@ -1270,7 +1270,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_F16_Vec2) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h)));
@@ -1301,7 +1301,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_Vec2_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_F32_Vec2_Const) {
auto* cast = vec4<f32>(1_f, 2_f, vec2<f32>(3_f, 4_f));
WrapInFunction(cast);
@@ -1321,7 +1321,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_Vec2_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_F16_Vec2_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(1_h, 2_h, vec2<f16>(3_h, 4_h));
@@ -1343,7 +1343,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec2_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Vec2_F32) {
auto* var = Decl(Var("x", ty.vec2<f32>(), vec2<f32>(2_f, 3_f)));
auto* cast = vec4<f32>(1_f, "x", 4_f);
WrapInFunction(var, cast);
@@ -1374,7 +1374,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec2_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_Vec2_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(2_h, 3_h)));
@@ -1407,7 +1407,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec2_F32_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Vec2_F32_Const) {
auto* cast = vec4<f32>(1_f, vec2<f32>(2_f, 3_f), 4_f);
WrapInFunction(cast);
@@ -1427,7 +1427,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec2_F16_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_Vec2_F16_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(1_h, vec2<f16>(2_h, 3_h), 4_h);
@@ -1449,7 +1449,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F32_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec2_F32_F32) {
auto* var = Decl(Var("x", ty.vec2<f32>(), vec2<f32>(1_f, 2_f)));
auto* cast = vec4<f32>("x", 3_f, 4_f);
WrapInFunction(var, cast);
@@ -1480,7 +1480,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F16_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec2_F16_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h)));
@@ -1513,7 +1513,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F32_F32_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec2_F32_F32_Const) {
auto* cast = vec4<f32>(vec2<f32>(1_f, 2_f), 3_f, 4_f);
WrapInFunction(cast);
@@ -1533,7 +1533,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F16_F16_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec2_F16_F16_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(1_h, 2_h), 3_h, 4_h);
@@ -1555,7 +1555,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_F32_With_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_F32_With_Vec2_Vec2) {
auto* var = Decl(Var("x", ty.vec2<f32>(), vec2<f32>(1_f, 2_f)));
auto* cast = vec4<f32>("x", "x");
WrapInFunction(var, cast);
@@ -1587,7 +1587,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_F16_With_Vec2_Vec2) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h)));
@@ -1621,7 +1621,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_F32_With_Vec2_Vec2_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_F32_With_Vec2_Vec2_Const) {
auto* cast = vec4<f32>(vec2<f32>(1_f, 2_f), vec2<f32>(1_f, 2_f));
WrapInFunction(cast);
@@ -1639,7 +1639,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec2_Vec2_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_F16_With_Vec2_Vec2_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(1_h, 2_h), vec2<f16>(1_h, 2_h));
@@ -1659,7 +1659,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Vec3) {
auto* var = Decl(Var("x", ty.vec3<f32>(), vec3<f32>(2_f, 2_f, 2_f)));
auto* cast = vec4<f32>(2_f, "x");
WrapInFunction(var, cast);
@@ -1688,7 +1688,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_Vec3) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec3<f16>(), vec3<f16>(2_h, 2_h, 2_h)));
@@ -1719,7 +1719,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec3_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Vec3_Const) {
auto* cast = vec4<f32>(2_f, vec3<f32>(2_f, 2_f, 2_f));
WrapInFunction(cast);
@@ -1736,7 +1736,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec3_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_Vec3_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, vec3<f16>(2_h, 2_h, 2_h));
@@ -1755,7 +1755,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec3_F32) {
auto* var = Decl(Var("x", ty.vec3<f32>(), vec3<f32>(2_f, 2_f, 2_f)));
auto* cast = vec4<f32>("x", 2_f);
WrapInFunction(var, cast);
@@ -1784,7 +1784,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec3_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec3<f16>(), vec3<f16>(2_h, 2_h, 2_h)));
@@ -1815,7 +1815,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F32_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec3_F32_Const) {
auto* cast = vec4<f32>(vec3<f32>(2_f, 2_f, 2_f), 2_f);
WrapInFunction(cast);
@@ -1832,7 +1832,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F16_Const) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec3_F16_Const) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec3<f16>(2_h, 2_h, 2_h), 2_h);
@@ -1851,7 +1851,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_F32_With_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_F32_With_Vec4) {
auto* value = vec4<f32>(2_f, 2_f, 2_f, 2_f);
auto* cast = vec4<f32>(value);
WrapInFunction(cast);
@@ -1869,7 +1869,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_Vec4_F16_With_Vec4) {
Enable(builtin::Extension::kF16);
auto* value = vec4<f16>(2_h, 2_h, 2_h, 2_h);
@@ -1889,7 +1889,7 @@
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_F32_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_F32_With_F32) {
auto* ctor = Call<f32>(2_f);
GlobalConst("g", ty.f32(), ctor);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -1910,7 +1910,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_F16_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_F16_With_F16) {
Enable(builtin::Extension::kF16);
auto* ctor = Call<f16>(2_h);
@@ -1933,7 +1933,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_F32_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_F32_With_F32) {
auto* ctor = Call<f32>(2_f);
GlobalVar("g", ty.f32(), builtin::AddressSpace::kPrivate, ctor);
@@ -1950,7 +1950,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_F16_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_F16_With_F16) {
Enable(builtin::Extension::kF16);
auto* ctor = Call<f16>(2_h);
@@ -1969,7 +1969,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_U32_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_U32_With_F32) {
auto* ctor = Call<u32>(1.5_f);
GlobalConst("g", ty.u32(), ctor);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -1990,7 +1990,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_U32_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_U32_With_F16) {
Enable(builtin::Extension::kF16);
auto* ctor = Call<u32>(1.5_h);
@@ -2013,7 +2013,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_U32_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_U32_With_F32) {
auto* ctor = Call<u32>(1.5_f);
GlobalVar("g", ty.u32(), builtin::AddressSpace::kPrivate, ctor);
@@ -2030,7 +2030,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_U32_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_U32_With_F16) {
Enable(builtin::Extension::kF16);
auto* ctor = Call<u32>(1.5_h);
@@ -2049,7 +2049,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec2_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec2_With_F32) {
auto* cast = vec2<f32>(2_f);
GlobalConst("g", ty.vec2<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2072,7 +2072,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec2_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec2_With_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(2_h);
@@ -2097,14 +2097,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec2_With_F32) {
auto* cast = vec2<f32>(2_f);
auto* g = GlobalVar("g", ty.vec2<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 2
@@ -2113,7 +2113,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec2_With_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(2_h);
@@ -2122,7 +2122,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 2
@@ -2131,7 +2131,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec2_F32_With_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec2_F32_With_Vec2) {
auto* cast = vec2<f32>(vec2<f32>(2_f, 2_f));
GlobalConst("g", ty.vec2<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2154,7 +2154,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec2_F16_With_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec2_F16_With_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(vec2<f16>(2_h, 2_h));
@@ -2179,7 +2179,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_F32_With_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec2_F32_With_Vec2) {
auto* cast = vec2<f32>(vec2<f32>(2_f, 2_f));
GlobalVar("a", ty.vec2<f32>(), builtin::AddressSpace::kPrivate, cast);
@@ -2199,7 +2199,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_F16_With_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec2_F16_With_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(vec2<f16>(2_h, 2_h));
@@ -2221,7 +2221,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_F32_With_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_F32_With_Vec3) {
auto* cast = vec3<f32>(vec3<f32>(2_f, 2_f, 2_f));
GlobalConst("g", ty.vec3<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2244,7 +2244,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_F16_With_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_F16_With_Vec3) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec3<f16>(2_h, 2_h, 2_h));
@@ -2269,7 +2269,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_F32_With_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_F32_With_Vec3) {
auto* cast = vec3<f32>(vec3<f32>(2_f, 2_f, 2_f));
GlobalVar("a", ty.vec3<f32>(), builtin::AddressSpace::kPrivate, cast);
@@ -2289,7 +2289,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_F16_With_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_F16_With_Vec3) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec3<f16>(2_h, 2_h, 2_h));
@@ -2311,7 +2311,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_F32_With_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_F32_With_Vec4) {
auto* cast = vec4<f32>(vec4<f32>(2_f, 2_f, 2_f, 2_f));
GlobalConst("g", ty.vec4<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2334,7 +2334,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_F16_With_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_F16_With_Vec4) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h));
@@ -2359,7 +2359,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F32_With_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_F32_With_Vec4) {
auto* cast = vec4<f32>(vec4<f32>(2_f, 2_f, 2_f, 2_f));
GlobalVar("a", ty.vec4<f32>(), builtin::AddressSpace::kPrivate, cast);
@@ -2379,7 +2379,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F16_With_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_F16_With_Vec4) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h));
@@ -2401,7 +2401,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_F32) {
auto* cast = vec3<f32>(2_f);
GlobalConst("g", ty.vec3<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2424,7 +2424,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(2_h);
@@ -2449,14 +2449,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_F32) {
auto* cast = vec3<f32>(2_f);
auto* g = GlobalVar("g", ty.vec3<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 3
@@ -2465,7 +2465,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(2_h);
@@ -2474,7 +2474,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 3
@@ -2483,7 +2483,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_F32_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_F32_Vec2) {
auto* cast = vec3<f32>(2_f, vec2<f32>(2_f, 2_f));
GlobalConst("g", ty.vec3<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2506,7 +2506,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_F16_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_F16_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(2_h, vec2<f16>(2_h, 2_h));
@@ -2531,14 +2531,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F32_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_F32_Vec2) {
auto* cast = vec3<f32>(2_f, vec2<f32>(2_f, 2_f));
auto* g = GlobalVar("g", ty.vec3<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 3
@@ -2547,7 +2547,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F16_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_F16_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(2_h, vec2<f16>(2_h, 2_h));
@@ -2556,7 +2556,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 3
@@ -2565,7 +2565,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_Vec2_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_Vec2_F32) {
auto* cast = vec3<f32>(vec2<f32>(2_f, 2_f), 2_f);
GlobalConst("g", ty.vec3<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2588,7 +2588,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_Vec2_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_Vec2_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec2<f16>(2_h, 2_h), 2_h);
@@ -2613,14 +2613,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_Vec2_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_Vec2_F32) {
auto* cast = vec3<f32>(vec2<f32>(2_f, 2_f), 2_f);
auto* g = GlobalVar("g", ty.vec3<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 3
@@ -2629,7 +2629,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_Vec2_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_Vec2_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec2<f16>(2_h, 2_h), 2_h);
@@ -2638,7 +2638,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 3
@@ -2647,7 +2647,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F32) {
auto* cast = vec4<f32>(2_f);
GlobalConst("g", ty.vec4<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2670,7 +2670,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h);
@@ -2695,14 +2695,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F32) {
auto* cast = vec4<f32>(2_f);
auto* g = GlobalVar("g", ty.vec4<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 4
@@ -2711,7 +2711,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h);
@@ -2720,7 +2720,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 4
@@ -2729,7 +2729,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F32_F32_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F32_F32_Vec2) {
auto* cast = vec4<f32>(2_f, 2_f, vec2<f32>(2_f, 2_f));
GlobalConst("g", ty.vec4<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2752,7 +2752,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16_F16_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F16_F16_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, 2_h, vec2<f16>(2_h, 2_h));
@@ -2777,14 +2777,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32_F32_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F32_F32_Vec2) {
auto* cast = vec4<f32>(2_f, 2_f, vec2<f32>(2_f, 2_f));
auto* g = GlobalVar("g", ty.vec4<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 4
@@ -2793,7 +2793,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_F16_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F16_F16_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, 2_h, vec2<f16>(2_h, 2_h));
@@ -2802,7 +2802,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 4
@@ -2811,7 +2811,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F32_Vec2_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F32_Vec2_F32) {
auto* cast = vec4<f32>(2_f, vec2<f32>(2_f, 2_f), 2_f);
GlobalConst("g", ty.vec4<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2834,7 +2834,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16_Vec2_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F16_Vec2_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, vec2<f16>(2_h, 2_h), 2_h);
@@ -2859,14 +2859,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32_Vec2_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F32_Vec2_F32) {
auto* cast = vec4<f32>(2_f, vec2<f32>(2_f, 2_f), 2_f);
auto* g = GlobalVar("g", ty.vec4<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 4
@@ -2875,7 +2875,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_Vec2_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F16_Vec2_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, vec2<f16>(2_h, 2_h), 2_h);
@@ -2884,7 +2884,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 4
@@ -2893,7 +2893,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_Vec2_F32_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_Vec2_F32_F32) {
auto* cast = vec4<f32>(vec2<f32>(2_f, 2_f), 2_f, 2_f);
GlobalConst("g", ty.vec4<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2916,7 +2916,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_Vec2_F16_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_Vec2_F16_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), 2_h, 2_h);
@@ -2941,14 +2941,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec2_F32_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_Vec2_F32_F32) {
auto* cast = vec4<f32>(vec2<f32>(2_f, 2_f), 2_f, 2_f);
auto* g = GlobalVar("g", ty.vec4<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 4
@@ -2957,7 +2957,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec2_F16_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_Vec2_F16_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), 2_h, 2_h);
@@ -2966,7 +2966,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 4
@@ -2975,7 +2975,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_F32_With_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_F32_With_Vec2_Vec2) {
auto* cast = vec4<f32>(vec2<f32>(2_f, 2_f), vec2<f32>(2_f, 2_f));
GlobalConst("g", ty.vec4<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -2998,7 +2998,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_F16_With_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_F16_With_Vec2_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h));
@@ -3023,14 +3023,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F32_With_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_F32_With_Vec2_Vec2) {
auto* cast = vec4<f32>(vec2<f32>(2_f, 2_f), vec2<f32>(2_f, 2_f));
auto* g = GlobalVar("g", ty.vec4<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 4
@@ -3039,7 +3039,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F16_With_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_F16_With_Vec2_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h));
@@ -3048,7 +3048,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 4
@@ -3057,7 +3057,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F32_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F32_Vec3) {
auto* cast = vec4<f32>(2_f, vec3<f32>(2_f, 2_f, 2_f));
GlobalConst("g", ty.vec4<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -3080,14 +3080,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F32_Vec3) {
auto* cast = vec4<f32>(2_f, vec3<f32>(2_f, 2_f, 2_f));
auto* g = GlobalVar("g", ty.vec4<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 4
@@ -3096,7 +3096,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F16_Vec3) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, vec3<f16>(2_h, 2_h, 2_h));
@@ -3105,7 +3105,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 4
@@ -3114,7 +3114,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_Vec3_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_Vec3_F32) {
auto* cast = vec4<f32>(vec3<f32>(2_f, 2_f, 2_f), 2_f);
GlobalConst("g", ty.vec4<f32>(), cast);
WrapInFunction(Decl(Var("l", Expr("g"))));
@@ -3137,7 +3137,7 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_Vec3_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_Vec3_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec3<f16>(2_h, 2_h, 2_h), 2_h);
@@ -3162,14 +3162,14 @@
Validate(b);
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec3_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_Vec3_F32) {
auto* cast = vec4<f32>(vec3<f32>(2_f, 2_f, 2_f), 2_f);
auto* g = GlobalVar("g", ty.vec4<f32>(), builtin::AddressSpace::kPrivate, cast);
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
%1 = OpTypeVector %2 4
@@ -3178,7 +3178,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec3_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_Vec3_F16) {
Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec3<f16>(2_h, 2_h, 2_h), 2_h);
@@ -3187,7 +3187,7 @@
spirv::Builder& b = Build();
b.push_function(Function{});
- EXPECT_EQ(b.GenerateInitializerExpression(g, cast), 4u);
+ EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u);
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16
%1 = OpTypeVector %2 4
@@ -3196,7 +3196,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat2x2_F32_With_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat2x2_F32_With_Vec2_Vec2) {
auto* cast = mat2x2<f32>(vec2<f32>(2_f, 2_f), vec2<f32>(2_f, 2_f));
WrapInFunction(cast);
@@ -3214,7 +3214,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat2x2_F16_With_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat2x2_F16_With_Vec2_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = mat2x2<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h));
@@ -3234,7 +3234,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat3x2_F32_With_Vec2_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat3x2_F32_With_Vec2_Vec2_Vec2) {
auto* cast = mat3x2<f32>(vec2<f32>(2_f, 2_f), vec2<f32>(2_f, 2_f), vec2<f32>(2_f, 2_f));
WrapInFunction(cast);
@@ -3252,7 +3252,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat3x2_F16_With_Vec2_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat3x2_F16_With_Vec2_Vec2_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = mat3x2<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h));
@@ -3272,7 +3272,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat4x2_F32_With_Vec2_Vec2_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat4x2_F32_With_Vec2_Vec2_Vec2_Vec2) {
auto* cast = mat4x2<f32>(vec2<f32>(2_f, 2_f), vec2<f32>(2_f, 2_f), vec2<f32>(2_f, 2_f),
vec2<f32>(2_f, 2_f));
WrapInFunction(cast);
@@ -3291,7 +3291,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat4x2_F16_With_Vec2_Vec2_Vec2_Vec2) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat4x2_F16_With_Vec2_Vec2_Vec2_Vec2) {
Enable(builtin::Extension::kF16);
auto* cast = mat4x2<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h),
@@ -3312,7 +3312,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat2x3_F32_With_Vec3_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat2x3_F32_With_Vec3_Vec3) {
auto* cast = mat2x3<f32>(vec3<f32>(2_f, 2_f, 2_f), vec3<f32>(2_f, 2_f, 2_f));
WrapInFunction(cast);
@@ -3330,7 +3330,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat2x3_F16_With_Vec3_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat2x3_F16_With_Vec3_Vec3) {
Enable(builtin::Extension::kF16);
auto* cast = mat2x3<f16>(vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h));
@@ -3350,7 +3350,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat3x3_F32_With_Vec3_Vec3_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat3x3_F32_With_Vec3_Vec3_Vec3) {
auto* cast =
mat3x3<f32>(vec3<f32>(2_f, 2_f, 2_f), vec3<f32>(2_f, 2_f, 2_f), vec3<f32>(2_f, 2_f, 2_f));
WrapInFunction(cast);
@@ -3369,7 +3369,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat3x3_F16_With_Vec3_Vec3_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat3x3_F16_With_Vec3_Vec3_Vec3) {
Enable(builtin::Extension::kF16);
auto* cast =
@@ -3390,7 +3390,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat4x3_F32_With_Vec3_Vec3_Vec3_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat4x3_F32_With_Vec3_Vec3_Vec3_Vec3) {
auto* cast = mat4x3<f32>(vec3<f32>(2_f, 2_f, 2_f), vec3<f32>(2_f, 2_f, 2_f),
vec3<f32>(2_f, 2_f, 2_f), vec3<f32>(2_f, 2_f, 2_f));
WrapInFunction(cast);
@@ -3409,7 +3409,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat4x3_F16_With_Vec3_Vec3_Vec3_Vec3) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat4x3_F16_With_Vec3_Vec3_Vec3_Vec3) {
Enable(builtin::Extension::kF16);
auto* cast = mat4x3<f16>(vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h),
@@ -3430,7 +3430,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat2x4_F32_With_Vec4_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat2x4_F32_With_Vec4_Vec4) {
auto* cast = mat2x4<f32>(vec4<f32>(2_f, 2_f, 2_f, 2_f), vec4<f32>(2_f, 2_f, 2_f, 2_f));
WrapInFunction(cast);
@@ -3448,7 +3448,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat2x4_F16_With_Vec4_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat2x4_F16_With_Vec4_Vec4) {
Enable(builtin::Extension::kF16);
auto* cast = mat2x4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h));
@@ -3468,7 +3468,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat3x4_F32_With_Vec4_Vec4_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat3x4_F32_With_Vec4_Vec4_Vec4) {
auto* cast = mat3x4<f32>(vec4<f32>(2_f, 2_f, 2_f, 2_f), vec4<f32>(2_f, 2_f, 2_f, 2_f),
vec4<f32>(2_f, 2_f, 2_f, 2_f));
WrapInFunction(cast);
@@ -3487,7 +3487,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat3x4_F16_With_Vec4_Vec4_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat3x4_F16_With_Vec4_Vec4_Vec4) {
Enable(builtin::Extension::kF16);
auto* cast = mat3x4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h),
@@ -3508,7 +3508,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat4x4_F32_With_Vec4_Vec4_Vec4_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat4x4_F32_With_Vec4_Vec4_Vec4_Vec4) {
auto* cast = mat4x4<f32>(vec4<f32>(2_f, 2_f, 2_f, 2_f), vec4<f32>(2_f, 2_f, 2_f, 2_f),
vec4<f32>(2_f, 2_f, 2_f, 2_f), vec4<f32>(2_f, 2_f, 2_f, 2_f));
WrapInFunction(cast);
@@ -3527,7 +3527,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Mat4x4_F16_With_Vec4_Vec4_Vec4_Vec4) {
+TEST_F(SpvBuilderConstructorTest, Type_Mat4x4_F16_With_Vec4_Vec4_Vec4_Vec4) {
Enable(builtin::Extension::kF16);
auto* cast = mat4x4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h),
@@ -3548,7 +3548,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Array_5_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Array_5_F32) {
auto* cast = array<f32, 5>(2_f, 2_f, 2_f, 2_f, 2_f);
WrapInFunction(cast);
@@ -3566,7 +3566,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Array_5_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Array_5_F16) {
Enable(builtin::Extension::kF16);
auto* cast = array<f16, 5>(2_h, 2_h, 2_h, 2_h, 2_h);
@@ -3586,7 +3586,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Array_2_Vec3_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Array_2_Vec3_F32) {
auto* first = vec3<f32>(1_f, 2_f, 3_f);
auto* second = vec3<f32>(1_f, 2_f, 3_f);
auto* t = Call(ty.array(ty.vec3<f32>(), 2_u), first, second);
@@ -3608,7 +3608,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Array_2_Vec3_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Array_2_Vec3_F16) {
Enable(builtin::Extension::kF16);
auto* first = vec3<f16>(1_h, 2_h, 3_h);
@@ -3632,7 +3632,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, CommonInitializer_TwoVectors) {
+TEST_F(SpvBuilderConstructorTest, CommonInitializer_TwoVectors) {
auto* v1 = vec3<f32>(2_f, 2_f, 2_f);
auto* v2 = vec3<f32>(2_f, 2_f, 2_f);
WrapInFunction(WrapInStatement(v1), WrapInStatement(v2));
@@ -3650,7 +3650,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, CommonInitializer_TwoArrays) {
+TEST_F(SpvBuilderConstructorTest, CommonInitializer_TwoArrays) {
auto* a1 = array<f32, 3>(2_f, 2_f, 2_f);
auto* a2 = array<f32, 3>(2_f, 2_f, 2_f);
WrapInFunction(WrapInStatement(a1), WrapInStatement(a2));
@@ -3670,7 +3670,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, CommonInitializer_Array_VecArray) {
+TEST_F(SpvBuilderConstructorTest, CommonInitializer_Array_VecArray) {
// Test that initializers of different types with the same values produce
// different OpConstantComposite instructions.
// crbug.com/tint/777
@@ -3695,7 +3695,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Struct) {
+TEST_F(SpvBuilderConstructorTest, Type_Struct) {
auto* s = Structure("my_struct", utils::Vector{
Member("a", ty.f32()),
Member("b", ty.vec3<f32>()),
@@ -3720,7 +3720,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_F32) {
auto* t = Call<f32>();
WrapInFunction(t);
@@ -3737,7 +3737,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_F16) {
Enable(builtin::Extension::kF16);
auto* t = Call<f16>();
@@ -3756,7 +3756,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_I32) {
+TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_I32) {
auto* t = Call<i32>();
WrapInFunction(t);
@@ -3773,7 +3773,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_U32) {
+TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_U32) {
auto* t = Call<u32>();
WrapInFunction(t);
@@ -3790,7 +3790,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Bool) {
+TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Bool) {
auto* t = Call<bool>();
WrapInFunction(t);
@@ -3807,7 +3807,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Vector) {
+TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Vector) {
auto* t = vec2<i32>();
WrapInFunction(t);
@@ -3825,7 +3825,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Matrix_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Matrix_F32) {
auto* t = mat4x2<f32>();
WrapInFunction(t);
@@ -3844,7 +3844,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Matrix_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Matrix_F16) {
Enable(builtin::Extension::kF16);
auto* t = mat4x2<f16>();
@@ -3865,7 +3865,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Array) {
+TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Array) {
auto* t = array<i32, 2>();
WrapInFunction(t);
@@ -3885,7 +3885,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Struct) {
+TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Struct) {
auto* s = Structure("my_struct", utils::Vector{Member("a", ty.f32())});
auto* t = Call(ty.Of(s));
WrapInFunction(t);
@@ -3903,7 +3903,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_U32_To_I32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_I32) {
auto* var = Decl(Var("x", ty.u32(), Expr(2_u)));
auto* cast = Call<i32>("x");
WrapInFunction(var, cast);
@@ -3927,7 +3927,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_F32_To_I32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_F32_To_I32) {
auto* var = Decl(Var("x", ty.f32(), Expr(2.4_f)));
auto* cast = Call<i32>("x");
WrapInFunction(var, cast);
@@ -3951,7 +3951,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_I32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_F16_To_I32) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2.4_h)));
@@ -3977,7 +3977,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_I32_To_U32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_U32) {
auto* var = Decl(Var("x", ty.i32(), Expr(2_i)));
auto* cast = Call<u32>("x");
WrapInFunction(var, cast);
@@ -4001,7 +4001,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_F32_To_U32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_F32_To_U32) {
auto* var = Decl(Var("x", ty.f32(), Expr(2.4_f)));
auto* cast = Call<u32>("x");
WrapInFunction(var, cast);
@@ -4025,7 +4025,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_U32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_F16_To_U32) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2.4_h)));
@@ -4051,7 +4051,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_I32_To_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_F32) {
auto* var = Decl(Var("x", ty.i32(), Expr(2_i)));
auto* cast = Call<f32>("x");
WrapInFunction(var, cast);
@@ -4075,7 +4075,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_U32_To_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_F32) {
auto* var = Decl(Var("x", ty.u32(), Expr(2_u)));
auto* cast = Call<f32>("x");
WrapInFunction(var, cast);
@@ -4099,7 +4099,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_F16_To_F32) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
@@ -4125,7 +4125,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_I32_To_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.i32(), Expr(2_i)));
@@ -4151,7 +4151,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_U32_To_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.u32(), Expr(2_u)));
@@ -4177,7 +4177,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_F32_To_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_F32_To_F16) {
Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f32(), Expr(2_f)));
@@ -4203,7 +4203,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_U32_to_I32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_I32) {
auto* var = GlobalVar("i", ty.vec3<u32>(), builtin::AddressSpace::kPrivate);
auto* cast = vec3<i32>("i");
@@ -4229,7 +4229,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F32_to_I32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F32_to_I32) {
auto* var = GlobalVar("i", ty.vec3<f32>(), builtin::AddressSpace::kPrivate);
auto* cast = vec3<i32>("i");
@@ -4255,7 +4255,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_I32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F16_to_I32) {
Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<f16>(), builtin::AddressSpace::kPrivate);
@@ -4283,7 +4283,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_I32_to_U32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_U32) {
auto* var = GlobalVar("i", ty.vec3<i32>(), builtin::AddressSpace::kPrivate);
auto* cast = vec3<u32>("i");
@@ -4309,7 +4309,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F32_to_U32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F32_to_U32) {
auto* var = GlobalVar("i", ty.vec3<f32>(), builtin::AddressSpace::kPrivate);
auto* cast = vec3<u32>("i");
@@ -4335,7 +4335,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_U32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F16_to_U32) {
Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<f16>(), builtin::AddressSpace::kPrivate);
@@ -4363,7 +4363,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_I32_to_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_F32) {
auto* var = GlobalVar("i", ty.vec3<i32>(), builtin::AddressSpace::kPrivate);
auto* cast = vec3<f32>("i");
@@ -4389,7 +4389,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_U32_to_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_F32) {
auto* var = GlobalVar("i", ty.vec3<u32>(), builtin::AddressSpace::kPrivate);
auto* cast = vec3<f32>("i");
@@ -4415,7 +4415,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_F32) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F16_to_F32) {
Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<f16>(), builtin::AddressSpace::kPrivate);
@@ -4443,7 +4443,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_I32_to_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_F16) {
Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<i32>(), builtin::AddressSpace::kPrivate);
@@ -4471,7 +4471,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_U32_to_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_F16) {
Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<u32>(), builtin::AddressSpace::kPrivate);
@@ -4499,7 +4499,7 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F32_to_F16) {
+TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F32_to_F16) {
Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<f32>(), builtin::AddressSpace::kPrivate);
@@ -4527,18 +4527,18 @@
)");
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_GlobalVectorWithAllConstInitializers) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalVectorWithAllConstInitializers) {
// vec3<f32>(1.0, 2.0, 3.0) -> true
auto* t = vec3<f32>(1_f, 2_f, 3_f);
WrapInFunction(t);
spirv::Builder& b = Build();
- EXPECT_TRUE(b.IsInitializerConst(t));
+ EXPECT_TRUE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_GlobalArrayWithAllConstInitializers) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalArrayWithAllConstInitializers) {
// array<vec3<f32>, 2u>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(1.0, 2.0, 3.0))
// -> true
auto* t =
@@ -4547,11 +4547,11 @@
spirv::Builder& b = Build();
- EXPECT_TRUE(b.IsInitializerConst(t));
+ EXPECT_TRUE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_GlobalVectorWithMatchingTypeInitializers) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalVectorWithMatchingTypeInitializers) {
// vec2<f32>(f32(1.0), f32(2.0)) -> false
auto* t = vec2<f32>(Call<f32>(1_f), Call<f32>(2_f));
@@ -4559,11 +4559,11 @@
spirv::Builder& b = Build();
- EXPECT_TRUE(b.IsInitializerConst(t));
+ EXPECT_TRUE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_GlobalWithTypeConversionInitializer) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalWithTypeConversionInitializer) {
// vec2<f32>(f32(1), f32(2)) -> false
auto* t = vec2<f32>(Call<f32>(1_i), Call<f32>(2_i));
@@ -4571,11 +4571,11 @@
spirv::Builder& b = Build();
- EXPECT_FALSE(b.IsInitializerConst(t));
+ EXPECT_FALSE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_VectorWithAllConstInitializers) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_VectorWithAllConstInitializers) {
// vec3<f32>(1.0, 2.0, 3.0) -> true
auto* t = vec3<f32>(1_f, 2_f, 3_f);
@@ -4583,11 +4583,11 @@
spirv::Builder& b = Build();
- EXPECT_TRUE(b.IsInitializerConst(t));
+ EXPECT_TRUE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_Vector_WithIdent) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Vector_WithIdent) {
// vec3<f32>(a, b, c) -> false
GlobalVar("a", ty.f32(), builtin::AddressSpace::kPrivate);
@@ -4599,11 +4599,11 @@
spirv::Builder& b = Build();
- EXPECT_FALSE(b.IsInitializerConst(t));
+ EXPECT_FALSE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_ArrayWithAllConstInitializers) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_ArrayWithAllConstInitializers) {
// array<vec3<f32>, 2u>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(1.0, 2.0, 3.0))
// -> true
@@ -4615,11 +4615,11 @@
spirv::Builder& b = Build();
- EXPECT_TRUE(b.IsInitializerConst(t));
+ EXPECT_TRUE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_VectorWithTypeConversionConstInitializers) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_VectorWithTypeConversionConstInitializers) {
// vec2<f32>(f32(1), f32(2)) -> false
auto* t = vec2<f32>(Call<f32>(1_i), Call<f32>(2_i));
@@ -4627,21 +4627,21 @@
spirv::Builder& b = Build();
- EXPECT_FALSE(b.IsInitializerConst(t));
+ EXPECT_FALSE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_BitCastScalars) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_BitCastScalars) {
auto* t = vec2<u32>(Call<u32>(1_i), Call<u32>(1_i));
WrapInFunction(t);
spirv::Builder& b = Build();
- EXPECT_FALSE(b.IsInitializerConst(t));
+ EXPECT_FALSE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_Struct) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Struct) {
auto* s = Structure("my_struct", utils::Vector{
Member("a", ty.f32()),
Member("b", ty.vec3<f32>()),
@@ -4652,11 +4652,11 @@
spirv::Builder& b = Build();
- EXPECT_TRUE(b.IsInitializerConst(t));
+ EXPECT_TRUE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, IsInitializerConst_Struct_WithIdentSubExpression) {
+TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Struct_WithIdentSubExpression) {
auto* s = Structure("my_struct", utils::Vector{
Member("a", ty.f32()),
Member("b", ty.vec3<f32>()),
@@ -4670,11 +4670,11 @@
spirv::Builder& b = Build();
- EXPECT_FALSE(b.IsInitializerConst(t));
+ EXPECT_FALSE(b.IsConstructorConst(t));
EXPECT_FALSE(b.has_error());
}
-TEST_F(SpvBuilderInitializerTest, ConstantCompositeScoping) {
+TEST_F(SpvBuilderConstructorTest, ConstantCompositeScoping) {
// if (true) {
// let x = vec3<f32>(1.0, 2.0, 3.0);
// }
@@ -4715,9 +4715,9 @@
}
// TODO(crbug.com/tint/1155) Implement when overrides are fully implemented.
-// TEST_F(SpvBuilderInitializerTest, SpecConstantCompositeScoping)
+// TEST_F(SpvBuilderConstructorTest, SpecConstantCompositeScoping)
-TEST_F(SpvBuilderInitializerTest, CompositeConstructScoping) {
+TEST_F(SpvBuilderConstructorTest, CompositeConstructScoping) {
// var one = 1.0;
// if (true) {
// let x = vec3<f32>(one, 2.0, 3.0);
diff --git a/src/tint/writer/wgsl/generator_impl_initializer_test.cc b/src/tint/writer/wgsl/generator_impl_constructor_test.cc
similarity index 83%
rename from src/tint/writer/wgsl/generator_impl_initializer_test.cc
rename to src/tint/writer/wgsl/generator_impl_constructor_test.cc
index 0d5686e..c815f42 100644
--- a/src/tint/writer/wgsl/generator_impl_initializer_test.cc
+++ b/src/tint/writer/wgsl/generator_impl_constructor_test.cc
@@ -22,9 +22,9 @@
namespace tint::writer::wgsl {
namespace {
-using WgslGeneratorImplTest = TestHelper;
+using WgslGeneratorImplTest_Constructor = TestHelper;
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Bool) {
+TEST_F(WgslGeneratorImplTest_Constructor, Bool) {
WrapInFunction(Expr(false));
GeneratorImpl& gen = Build();
@@ -33,7 +33,7 @@
EXPECT_THAT(gen.result(), HasSubstr("false"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Int) {
+TEST_F(WgslGeneratorImplTest_Constructor, Int) {
WrapInFunction(Expr(-12345_i));
GeneratorImpl& gen = Build();
@@ -42,7 +42,7 @@
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_UInt) {
+TEST_F(WgslGeneratorImplTest_Constructor, UInt) {
WrapInFunction(Expr(56779_u));
GeneratorImpl& gen = Build();
@@ -51,7 +51,7 @@
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_F32) {
+TEST_F(WgslGeneratorImplTest_Constructor, F32) {
// Use a number close to 1<<30 but whose decimal representation ends in 0.
WrapInFunction(Expr(f32((1 << 30) - 4)));
@@ -61,7 +61,7 @@
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_F16) {
+TEST_F(WgslGeneratorImplTest_Constructor, F16) {
Enable(builtin::Extension::kF16);
// Use a number close to 1<<16 but whose decimal representation ends in 0.
@@ -73,7 +73,7 @@
EXPECT_THAT(gen.result(), HasSubstr("32752.0h"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F32) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_F32) {
WrapInFunction(Call<f32>(Expr(-1.2e-5_f)));
GeneratorImpl& gen = Build();
@@ -82,7 +82,7 @@
EXPECT_THAT(gen.result(), HasSubstr("f32(-0.000012f)"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F16) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(Call<f16>(Expr(-1.2e-5_h)));
@@ -93,7 +93,7 @@
EXPECT_THAT(gen.result(), HasSubstr("f16(-1.19805336e-05h)"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Bool) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_Bool) {
WrapInFunction(Call<bool>(true));
GeneratorImpl& gen = Build();
@@ -102,7 +102,7 @@
EXPECT_THAT(gen.result(), HasSubstr("bool(true)"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Int) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_Int) {
WrapInFunction(Call<i32>(-12345_i));
GeneratorImpl& gen = Build();
@@ -111,7 +111,7 @@
EXPECT_THAT(gen.result(), HasSubstr("i32(-12345i)"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Uint) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_Uint) {
WrapInFunction(Call<u32>(12345_u));
GeneratorImpl& gen = Build();
@@ -120,7 +120,7 @@
EXPECT_THAT(gen.result(), HasSubstr("u32(12345u)"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F32) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_Vec_F32) {
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
GeneratorImpl& gen = Build();
@@ -129,7 +129,7 @@
EXPECT_THAT(gen.result(), HasSubstr("vec3<f32>(1.0f, 2.0f, 3.0f)"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F16) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_Vec_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
@@ -140,7 +140,7 @@
EXPECT_THAT(gen.result(), HasSubstr("vec3<f16>(1.0h, 2.0h, 3.0h)"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F32) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_Mat_F32) {
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
GeneratorImpl& gen = Build();
@@ -150,7 +150,7 @@
"vec3<f32>(3.0f, 4.0f, 5.0f))"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F16) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_Mat_F16) {
Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h)));
@@ -162,7 +162,7 @@
"vec3<f16>(3.0h, 4.0h, 5.0h))"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Array) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_Array) {
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
@@ -174,7 +174,7 @@
"vec3<f32>(4.0f, 5.0f, 6.0f), vec3<f32>(7.0f, 8.0f, 9.0f))"));
}
-TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_ImplicitArray) {
+TEST_F(WgslGeneratorImplTest_Constructor, Type_ImplicitArray) {
WrapInFunction(Call(ty.array<Infer>(), vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(4_f, 5_f, 6_f),
vec3<f32>(7_f, 8_f, 9_f)));
diff --git a/test/tint/array/assign_to_function_var.wgsl b/test/tint/array/assign_to_function_var.wgsl
index ac8aa71..c89220d 100644
--- a/test/tint/array/assign_to_function_var.wgsl
+++ b/test/tint/array/assign_to_function_var.wgsl
@@ -22,7 +22,7 @@
var dst : ArrayType;
- // Assign from type constructor.
+ // Assign from value constructor.
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
// Assign from parameter.
diff --git a/test/tint/array/assign_to_private_var.wgsl b/test/tint/array/assign_to_private_var.wgsl
index 07f05a2..8180341 100644
--- a/test/tint/array/assign_to_private_var.wgsl
+++ b/test/tint/array/assign_to_private_var.wgsl
@@ -23,7 +23,7 @@
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
- // Assign from type constructor.
+ // Assign from value constructor.
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
// Assign from parameter.
diff --git a/test/tint/array/assign_to_storage_var.wgsl b/test/tint/array/assign_to_storage_var.wgsl
index 1b135c8..69fc1ab 100644
--- a/test/tint/array/assign_to_storage_var.wgsl
+++ b/test/tint/array/assign_to_storage_var.wgsl
@@ -27,7 +27,7 @@
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
- // Assign from type constructor.
+ // Assign from value constructor.
dst.arr = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
// Assign from parameter.
diff --git a/test/tint/array/assign_to_workgroup_var.wgsl b/test/tint/array/assign_to_workgroup_var.wgsl
index eb3a80b..74f3e67 100644
--- a/test/tint/array/assign_to_workgroup_var.wgsl
+++ b/test/tint/array/assign_to_workgroup_var.wgsl
@@ -23,7 +23,7 @@
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
- // Assign from type constructor.
+ // Assign from value constructor.
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
// Assign from parameter.
diff --git a/tools/src/tint/intrinsic/ast/ast.go b/tools/src/tint/intrinsic/ast/ast.go
index 321370a..98a8638 100644
--- a/tools/src/tint/intrinsic/ast/ast.go
+++ b/tools/src/tint/intrinsic/ast/ast.go
@@ -29,7 +29,7 @@
Types []TypeDecl
Matchers []MatcherDecl
Builtins []IntrinsicDecl
- Initializers []IntrinsicDecl
+ Constructors []IntrinsicDecl
Converters []IntrinsicDecl
Operators []IntrinsicDecl
}
@@ -52,7 +52,7 @@
fmt.Fprintf(&sb, "%v", b)
fmt.Fprintln(&sb)
}
- for _, o := range a.Initializers {
+ for _, o := range a.Constructors {
fmt.Fprintf(&sb, "%v", o)
fmt.Fprintln(&sb)
}
@@ -123,10 +123,10 @@
// Operator is a unary or binary operator.
// Declared with 'op'.
Operator IntrinsicKind = "operator"
- // Initializer is a type initializer function.
+ // Constructor is a value constructor function.
// Declared with 'init'.
- Initializer IntrinsicKind = "initializer"
- // Converter is a type conversion function.
+ Constructor IntrinsicKind = "constructor"
+ // Converter is a value conversion function.
// Declared with 'conv'.
Converter IntrinsicKind = "converter"
)
@@ -149,8 +149,8 @@
fmt.Fprintf(w, "fn ")
case Operator:
fmt.Fprintf(w, "op ")
- case Initializer:
- fmt.Fprintf(w, "init ")
+ case Constructor:
+ fmt.Fprintf(w, "ctor ")
case Converter:
fmt.Fprintf(w, "conv ")
}
diff --git a/tools/src/tint/intrinsic/gen/gen.go b/tools/src/tint/intrinsic/gen/gen.go
index 6bfd841..506e108 100644
--- a/tools/src/tint/intrinsic/gen/gen.go
+++ b/tools/src/tint/intrinsic/gen/gen.go
@@ -50,7 +50,7 @@
Builtins []Intrinsic // kBuiltins table content
UnaryOperators []Intrinsic // kUnaryOperators table content
BinaryOperators []Intrinsic // kBinaryOperators table content
- InitializersAndConverters []Intrinsic // kInitializersAndConverters table content
+ ConstructorsAndConverters []Intrinsic // kInitializersAndConverters table content
}
// TemplateType is used to create the C++ TemplateTypeInfo structure
@@ -387,7 +387,7 @@
{s.Builtins, &b.Builtins},
{s.UnaryOperators, &b.UnaryOperators},
{s.BinaryOperators, &b.BinaryOperators},
- {s.InitializersAndConverters, &b.InitializersAndConverters},
+ {s.ConstructorsAndConverters, &b.ConstructorsAndConverters},
} {
out := make([]Intrinsic, len(intrinsics.in))
for i, f := range intrinsics.in {
diff --git a/tools/src/tint/intrinsic/lexer/lexer.go b/tools/src/tint/intrinsic/lexer/lexer.go
index 51045d6..b76b1ab 100644
--- a/tools/src/tint/intrinsic/lexer/lexer.go
+++ b/tools/src/tint/intrinsic/lexer/lexer.go
@@ -104,8 +104,8 @@
l.tok(n, tok.Enum)
case "type":
l.tok(n, tok.Type)
- case "init":
- l.tok(n, tok.Initializer)
+ case "ctor":
+ l.tok(n, tok.Constructor)
case "conv":
l.tok(n, tok.Converter)
case "match":
diff --git a/tools/src/tint/intrinsic/lexer/lexer_test.go b/tools/src/tint/intrinsic/lexer/lexer_test.go
index 9eda8b6..7d16fb6 100644
--- a/tools/src/tint/intrinsic/lexer/lexer_test.go
+++ b/tools/src/tint/intrinsic/lexer/lexer_test.go
@@ -90,7 +90,7 @@
{"type", []tok.Token{{Kind: tok.Type, Runes: []rune("type"), Source: tok.Source{
S: loc(1, 1, 0), E: loc(1, 5, 4),
}}}},
- {"init", []tok.Token{{Kind: tok.Initializer, Runes: []rune("init"), Source: tok.Source{
+ {"ctor", []tok.Token{{Kind: tok.Constructor, Runes: []rune("ctor"), Source: tok.Source{
S: loc(1, 1, 0), E: loc(1, 5, 4),
}}}},
{"conv", []tok.Token{{Kind: tok.Converter, Runes: []rune("conv"), Source: tok.Source{
diff --git a/tools/src/tint/intrinsic/parser/parser.go b/tools/src/tint/intrinsic/parser/parser.go
index 418d543..35f5e00 100644
--- a/tools/src/tint/intrinsic/parser/parser.go
+++ b/tools/src/tint/intrinsic/parser/parser.go
@@ -72,8 +72,8 @@
case tok.Operator:
out.Operators = append(out.Operators, p.operatorDecl(attributes))
attributes = nil
- case tok.Initializer:
- out.Initializers = append(out.Initializers, p.initializerDecl(attributes))
+ case tok.Constructor:
+ out.Constructors = append(out.Constructors, p.constructorDecl(attributes))
attributes = nil
case tok.Converter:
out.Converters = append(out.Converters, p.converterDecl(attributes))
@@ -221,12 +221,12 @@
return f
}
-func (p *parser) initializerDecl(decos ast.Attributes) ast.IntrinsicDecl {
- p.expect(tok.Initializer, "initializer declaration")
+func (p *parser) constructorDecl(decos ast.Attributes) ast.IntrinsicDecl {
+ p.expect(tok.Constructor, "constructor declaration")
name := p.next()
f := ast.IntrinsicDecl{
Source: name.Source,
- Kind: ast.Initializer,
+ Kind: ast.Constructor,
Attributes: decos,
Name: string(name.Runes),
}
diff --git a/tools/src/tint/intrinsic/parser/parser_test.go b/tools/src/tint/intrinsic/parser/parser_test.go
index 97c41f7..ad4cca3 100644
--- a/tools/src/tint/intrinsic/parser/parser_test.go
+++ b/tools/src/tint/intrinsic/parser/parser_test.go
@@ -440,20 +440,20 @@
},
}, { ///////////////////////////////////////////////////////////////////
fileutils.ThisLine(),
- "init F()",
+ "ctor F()",
ast.AST{
- Initializers: []ast.IntrinsicDecl{{
- Kind: ast.Initializer,
+ Constructors: []ast.IntrinsicDecl{{
+ Kind: ast.Constructor,
Name: "F",
Parameters: ast.Parameters{},
}},
},
}, { ///////////////////////////////////////////////////////////////////
fileutils.ThisLine(),
- "@attr init F()",
+ "@attr ctor F()",
ast.AST{
- Initializers: []ast.IntrinsicDecl{{
- Kind: ast.Initializer,
+ Constructors: []ast.IntrinsicDecl{{
+ Kind: ast.Constructor,
Name: "F",
Attributes: ast.Attributes{
{Name: "attr", Values: nil},
@@ -463,10 +463,10 @@
},
}, { ///////////////////////////////////////////////////////////////////
fileutils.ThisLine(),
- "init F(a)",
+ "ctor F(a)",
ast.AST{
- Initializers: []ast.IntrinsicDecl{{
- Kind: ast.Initializer,
+ Constructors: []ast.IntrinsicDecl{{
+ Kind: ast.Constructor,
Name: "F",
Parameters: ast.Parameters{
{Type: ast.TemplatedName{Name: "a"}},
@@ -475,10 +475,10 @@
},
}, { ///////////////////////////////////////////////////////////////////
fileutils.ThisLine(),
- "init F(a: T)",
+ "ctor F(a: T)",
ast.AST{
- Initializers: []ast.IntrinsicDecl{{
- Kind: ast.Initializer,
+ Constructors: []ast.IntrinsicDecl{{
+ Kind: ast.Constructor,
Name: "F",
Parameters: ast.Parameters{
{Name: "a", Type: ast.TemplatedName{Name: "T"}},
@@ -487,10 +487,10 @@
},
}, { ///////////////////////////////////////////////////////////////////
fileutils.ThisLine(),
- "init F(a, b)",
+ "ctor F(a, b)",
ast.AST{
- Initializers: []ast.IntrinsicDecl{{
- Kind: ast.Initializer,
+ Constructors: []ast.IntrinsicDecl{{
+ Kind: ast.Constructor,
Name: "F",
Parameters: ast.Parameters{
{Type: ast.TemplatedName{Name: "a"}},
@@ -500,10 +500,10 @@
},
}, { ///////////////////////////////////////////////////////////////////
fileutils.ThisLine(),
- "init F<A : B<C> >()",
+ "ctor F<A : B<C> >()",
ast.AST{
- Initializers: []ast.IntrinsicDecl{{
- Kind: ast.Initializer,
+ Constructors: []ast.IntrinsicDecl{{
+ Kind: ast.Constructor,
Name: "F",
TemplateParams: ast.TemplateParams{
{
@@ -520,10 +520,10 @@
},
}, { ///////////////////////////////////////////////////////////////////
fileutils.ThisLine(),
- "init F<T>(a: X, b: Y<T>)",
+ "ctor F<T>(a: X, b: Y<T>)",
ast.AST{
- Initializers: []ast.IntrinsicDecl{{
- Kind: ast.Initializer,
+ Constructors: []ast.IntrinsicDecl{{
+ Kind: ast.Constructor,
Name: "F",
TemplateParams: ast.TemplateParams{
{Name: "T"},
@@ -539,10 +539,10 @@
},
}, { ///////////////////////////////////////////////////////////////////
fileutils.ThisLine(),
- "init F() -> X",
+ "ctor F() -> X",
ast.AST{
- Initializers: []ast.IntrinsicDecl{{
- Kind: ast.Initializer,
+ Constructors: []ast.IntrinsicDecl{{
+ Kind: ast.Constructor,
Name: "F",
ReturnType: &ast.TemplatedName{Name: "X"},
Parameters: ast.Parameters{},
@@ -550,10 +550,10 @@
},
}, { ///////////////////////////////////////////////////////////////////
fileutils.ThisLine(),
- "init F() -> X<T>",
+ "ctor F() -> X<T>",
ast.AST{
- Initializers: []ast.IntrinsicDecl{{
- Kind: ast.Initializer,
+ Constructors: []ast.IntrinsicDecl{{
+ Kind: ast.Constructor,
Name: "F",
ReturnType: &ast.TemplatedName{
Name: "X",
diff --git a/tools/src/tint/intrinsic/resolver/resolve.go b/tools/src/tint/intrinsic/resolver/resolve.go
index 398cd3d..787eca7 100644
--- a/tools/src/tint/intrinsic/resolver/resolve.go
+++ b/tools/src/tint/intrinsic/resolver/resolve.go
@@ -32,7 +32,7 @@
builtins map[string]*sem.Intrinsic
unaryOperators map[string]*sem.Intrinsic
binaryOperators map[string]*sem.Intrinsic
- initializersAndConverters map[string]*sem.Intrinsic
+ constructorsAndConverters map[string]*sem.Intrinsic
enumEntryMatchers map[*sem.EnumEntry]*sem.EnumMatcher
}
@@ -45,7 +45,7 @@
builtins: map[string]*sem.Intrinsic{},
unaryOperators: map[string]*sem.Intrinsic{},
binaryOperators: map[string]*sem.Intrinsic{},
- initializersAndConverters: map[string]*sem.Intrinsic{},
+ constructorsAndConverters: map[string]*sem.Intrinsic{},
enumEntryMatchers: map[*sem.EnumEntry]*sem.EnumMatcher{},
}
// Declare and resolve all the enumerators
@@ -88,9 +88,9 @@
}
}
- // Declare and resolve type initializers and converters
- for _, c := range a.Initializers {
- if err := r.intrinsic(c, r.initializersAndConverters, &r.s.InitializersAndConverters); err != nil {
+ // Declare and resolve value constructors and converters
+ for _, c := range a.Constructors {
+ if err := r.intrinsic(c, r.constructorsAndConverters, &r.s.ConstructorsAndConverters); err != nil {
return nil, err
}
}
@@ -98,7 +98,7 @@
if len(c.Parameters) != 1 {
return nil, fmt.Errorf("%v conversions must have a single parameter", c.Source)
}
- if err := r.intrinsic(c, r.initializersAndConverters, &r.s.InitializersAndConverters); err != nil {
+ if err := r.intrinsic(c, r.constructorsAndConverters, &r.s.ConstructorsAndConverters); err != nil {
return nil, err
}
}
@@ -360,8 +360,8 @@
switch overload.Decl.Kind {
case ast.Builtin, ast.Operator:
overload.ConstEvalFunction = overload.Decl.Name
- case ast.Initializer:
- overload.ConstEvalFunction = "Init"
+ case ast.Constructor:
+ overload.ConstEvalFunction = "Ctor"
case ast.Converter:
overload.ConstEvalFunction = "Conv"
}
@@ -601,7 +601,7 @@
r.s.Builtins,
r.s.UnaryOperators,
r.s.BinaryOperators,
- r.s.InitializersAndConverters,
+ r.s.ConstructorsAndConverters,
} {
for _, i := range intrinsics {
for _, o := range i.Overloads {
diff --git a/tools/src/tint/intrinsic/resolver/resolver_test.go b/tools/src/tint/intrinsic/resolver/resolver_test.go
index da1036e..19ad980 100644
--- a/tools/src/tint/intrinsic/resolver/resolver_test.go
+++ b/tools/src/tint/intrinsic/resolver/resolver_test.go
@@ -157,13 +157,13 @@
}, {
`
type f32
-init f32(f32)`,
+ctor f32(f32)`,
success,
}, {
`
type f32
type T<x>
-init f32(T<f32>)`,
+ctor f32(T<f32>)`,
success,
}, {
`
@@ -392,57 +392,57 @@
`
type i
enum e { a }
-init F(i) -> e`,
+ctor F(i) -> e`,
`file.txt:3:14 cannot use 'e' as return type. Must be a type or template type`,
}, {
`
type T<x>
-init F(T<u>)`,
+ctor F(T<u>)`,
`file.txt:2:10 cannot resolve 'u'`,
}, {
`
type x
-init F<T>(T<x>)`,
+ctor F<T>(T<x>)`,
`file.txt:2:11 'T' template parameters do not accept template arguments`,
}, {
`
type A<N: num>
type B
-init F(A<B>)`,
+ctor F(A<B>)`,
`file.txt:3:10 cannot use type 'B' as template number`,
}, {
`
type A<N>
enum E { b }
match M: E.b
-init F(A<M>)`,
+ctor F(A<M>)`,
`file.txt:4:10 cannot use enum matcher 'M' as template type`,
}, {
`
type T
type P<N: num>
match m: T
-init F(P<m>)`,
+ctor F(P<m>)`,
`file.txt:4:10 cannot use type matcher 'm' as template number`,
}, {
`
type P<N: num>
enum E { b }
-init F(P<E>)`,
+ctor F(P<E>)`,
`file.txt:3:10 cannot use enum 'E' as template number`,
}, {
`
type P<N: num>
enum E { a b }
match m: E.a | E.b
-init F(P<m>)`,
+ctor F(P<m>)`,
`file.txt:4:10 cannot use enum matcher 'm' as template number`,
}, {
`
type P<N: num>
enum E { a b }
match m: E.a | E.b
-init F<M: m>(P<M>)`,
+ctor F<M: m>(P<M>)`,
`file.txt:4:16 cannot use template enum 'E' as template number`,
}, {
`
diff --git a/tools/src/tint/intrinsic/sem/sem.go b/tools/src/tint/intrinsic/sem/sem.go
index fad95a6..dcec878 100644
--- a/tools/src/tint/intrinsic/sem/sem.go
+++ b/tools/src/tint/intrinsic/sem/sem.go
@@ -31,7 +31,7 @@
Builtins []*Intrinsic
UnaryOperators []*Intrinsic
BinaryOperators []*Intrinsic
- InitializersAndConverters []*Intrinsic
+ ConstructorsAndConverters []*Intrinsic
// Maximum number of template types used across all builtins
MaxTemplateTypes int
// Maximum number of template numbers used across all builtins
diff --git a/tools/src/tint/intrinsic/tok/tok.go b/tools/src/tint/intrinsic/tok/tok.go
index 0516ce9..9f27f0a 100644
--- a/tools/src/tint/intrinsic/tok/tok.go
+++ b/tools/src/tint/intrinsic/tok/tok.go
@@ -31,7 +31,7 @@
Match Kind = "match"
Function Kind = "fn"
Operator Kind = "op"
- Initializer Kind = "init"
+ Constructor Kind = "ctor"
Converter Kind = "conv"
Type Kind = "type"
Enum Kind = "enum"