diff --git a/src/ast/type/array_type.cc b/src/ast/type/array_type.cc index 6fb5f95834..683f6aa333 100644 --- a/src/ast/type/array_type.cc +++ b/src/ast/type/array_type.cc @@ -38,7 +38,7 @@ std::string ArrayType::type_name() const { if (!IsRuntimeArray()) type_name += "_" + std::to_string(size_); if (has_array_stride()) - type_name += "_" + std::to_string(array_stride_); + type_name += "_stride_" + std::to_string(array_stride_); return type_name; } diff --git a/src/ast/type/array_type_test.cc b/src/ast/type/array_type_test.cc index a4e4eae1b0..678fee5f09 100644 --- a/src/ast/type/array_type_test.cc +++ b/src/ast/type/array_type_test.cc @@ -75,7 +75,7 @@ TEST_F(ArrayTypeTest, TypeName_WithStride) { I32Type i32; ArrayType arr{&i32, 3}; arr.set_array_stride(16); - EXPECT_EQ(arr.type_name(), "__array__i32_3_16"); + EXPECT_EQ(arr.type_name(), "__array__i32_3_stride_16"); } } // namespace diff --git a/src/reader/spirv/function_var_test.cc b/src/reader/spirv/function_var_test.cc index c160a2345a..d5de2e11a5 100644 --- a/src/reader/spirv/function_var_test.cc +++ b/src/reader/spirv/function_var_test.cc @@ -462,10 +462,10 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_AliasType) { Variable{ x_200 function - __alias_Arr__array__u32_2_16 + __alias_Arr__array__u32_2_stride_16 { TypeConstructor{ - __alias_Arr__array__u32_2_16 + __alias_Arr__array__u32_2_stride_16 ScalarConstructor{1} ScalarConstructor{2} } @@ -529,10 +529,10 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_AliasType_Null) { Variable{ x_200 function - __alias_Arr__array__u32_2_16 + __alias_Arr__array__u32_2_stride_16 { TypeConstructor{ - __alias_Arr__array__u32_2_16 + __alias_Arr__array__u32_2_stride_16 ScalarConstructor{0} ScalarConstructor{0} } diff --git a/src/reader/spirv/parser_impl_named_types_test.cc b/src/reader/spirv/parser_impl_named_types_test.cc index 1784c043dd..4d5939abbe 100644 --- a/src/reader/spirv/parser_impl_named_types_test.cc +++ b/src/reader/spirv/parser_impl_named_types_test.cc @@ -75,9 +75,8 @@ TEST_F(SpvParserTest, NamedTypes_AnonRTArrayWithDecoration) { %arr = OpTypeRuntimeArray %uint )")); EXPECT_TRUE(p->BuildAndParseInternalModule()); - // TODO(dneto): this is a string collision with array - // https://bugs.chromium.org/p/tint/issues/detail?id=102 - EXPECT_THAT(p->module().to_str(), HasSubstr("RTArr -> __array__u32_8\n")); + EXPECT_THAT(p->module().to_str(), + HasSubstr("RTArr -> __array__u32_stride_8\n")); } TEST_F(SpvParserTest, NamedTypes_AnonRTArray_Dup_EmitBoth) { @@ -89,9 +88,9 @@ TEST_F(SpvParserTest, NamedTypes_AnonRTArray_Dup_EmitBoth) { %arr2 = OpTypeRuntimeArray %uint )")); EXPECT_TRUE(p->BuildAndParseInternalModule()); - EXPECT_THAT( - p->module().to_str(), - HasSubstr("RTArr -> __array__u32_8\nRTArr_1 -> __array__u32_8\n")); + EXPECT_THAT(p->module().to_str(), + HasSubstr("RTArr -> __array__u32_stride_8\nRTArr_1 -> " + "__array__u32_stride_8\n")); } TEST_F(SpvParserTest, NamedTypes_NamedRTArray) { @@ -102,7 +101,8 @@ TEST_F(SpvParserTest, NamedTypes_NamedRTArray) { %arr = OpTypeRuntimeArray %uint )")); EXPECT_TRUE(p->BuildAndParseInternalModule()); - EXPECT_THAT(p->module().to_str(), HasSubstr("myrtarr -> __array__u32_8\n")); + EXPECT_THAT(p->module().to_str(), + HasSubstr("myrtarr -> __array__u32_stride_8\n")); } TEST_F(SpvParserTest, NamedTypes_NamedArray) { @@ -115,7 +115,8 @@ TEST_F(SpvParserTest, NamedTypes_NamedArray) { %arr2 = OpTypeArray %uint %uint_5 )")); EXPECT_TRUE(p->BuildAndParseInternalModule()); - EXPECT_THAT(p->module().to_str(), HasSubstr("myarr -> __array__u32_5_8")); + EXPECT_THAT(p->module().to_str(), + HasSubstr("myarr -> __array__u32_5_stride_8")); } TEST_F(SpvParserTest, NamedTypes_AnonArray_Dup_EmitBoth) { @@ -128,8 +129,10 @@ TEST_F(SpvParserTest, NamedTypes_AnonArray_Dup_EmitBoth) { %arr2 = OpTypeArray %uint %uint_5 )")); EXPECT_TRUE(p->BuildAndParseInternalModule()); - EXPECT_THAT(p->module().to_str(), - HasSubstr("Arr -> __array__u32_5_8\nArr_1 -> __array__u32_5_8")); + EXPECT_THAT( + p->module().to_str(), + HasSubstr( + "Arr -> __array__u32_5_stride_8\nArr_1 -> __array__u32_5_stride_")); } // TODO(dneto): Handle arrays sized by a spec constant.