tint: rename template argument token strings

Drop the `(opening|closing template argument list)` bit. It makes for messy diagnostics.

Change-Id: I92d29ece8a012362dd16da297089aab908571415
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117213
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2023-01-24 19:31:51 +00:00 committed by Dawn LUCI CQ
parent f0d8edecee
commit 7d2b192439
5 changed files with 23 additions and 40 deletions

View File

@ -120,9 +120,8 @@ fn f() { a = >; }
}
TEST_F(ParserImplErrorTest, BitcastExprMissingLessThan) {
EXPECT(
"fn f() { x = bitcast(y); }",
R"(test.wgsl:1:21 error: expected '< (opening template argument list)' for bitcast expression
EXPECT("fn f() { x = bitcast(y); }",
R"(test.wgsl:1:21 error: expected '<' for bitcast expression
fn f() { x = bitcast(y); }
^
)");
@ -660,9 +659,8 @@ TEST_F(ParserImplErrorTest, GlobalDeclInvalidAttribute) {
}
TEST_F(ParserImplErrorTest, GlobalDeclSampledTextureMissingLessThan) {
EXPECT(
"var x : texture_1d;",
R"(test.wgsl:1:19 error: expected '< (opening template argument list)' for sampled texture type
EXPECT("var x : texture_1d;",
R"(test.wgsl:1:19 error: expected '<' for sampled texture type
var x : texture_1d;
^
)");
@ -685,9 +683,8 @@ var x : texture_1d<1>;
}
TEST_F(ParserImplErrorTest, GlobalDeclMultisampledTextureMissingLessThan) {
EXPECT(
"var x : texture_multisampled_2d;",
R"(test.wgsl:1:32 error: expected '< (opening template argument list)' for multisampled texture type
EXPECT("var x : texture_multisampled_2d;",
R"(test.wgsl:1:32 error: expected '<' for multisampled texture type
var x : texture_multisampled_2d;
^
)");
@ -833,9 +830,8 @@ static_assert true static_assert true;
}
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingLessThan) {
EXPECT(
"var x : texture_storage_2d;",
R"(test.wgsl:1:27 error: expected '< (opening template argument list)' for storage texture type
EXPECT("var x : texture_storage_2d;",
R"(test.wgsl:1:27 error: expected '<' for storage texture type
var x : texture_storage_2d;
^
)");
@ -1200,9 +1196,8 @@ var i : i32
}
TEST_F(ParserImplErrorTest, GlobalDeclVarPtrMissingLessThan) {
EXPECT(
"var i : ptr;",
R"(test.wgsl:1:12 error: expected '< (opening template argument list)' for ptr declaration
EXPECT("var i : ptr;",
R"(test.wgsl:1:12 error: expected '<' for ptr declaration
var i : ptr;
^
)");
@ -1242,9 +1237,8 @@ var i : ptr<private, 1>;
}
TEST_F(ParserImplErrorTest, GlobalDeclVarAtomicMissingLessThan) {
EXPECT(
"var i : atomic;",
R"(test.wgsl:1:15 error: expected '< (opening template argument list)' for atomic declaration
EXPECT("var i : atomic;",
R"(test.wgsl:1:15 error: expected '<' for atomic declaration
var i : atomic;
^
)");

View File

@ -126,8 +126,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan) {
EXPECT_EQ(t.value, nullptr);
EXPECT_FALSE(t.matched);
EXPECT_TRUE(t.errored);
EXPECT_EQ(p->error(),
"1:11: expected '< (opening template argument list)' for sampled texture type");
EXPECT_EQ(p->error(), "1:11: expected '<' for sampled texture type");
}
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan) {
@ -170,8 +169,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingLessThan)
EXPECT_EQ(t.value, nullptr);
EXPECT_FALSE(t.matched);
EXPECT_TRUE(t.errored);
EXPECT_EQ(p->error(),
"1:24: expected '< (opening template argument list)' for multisampled texture type");
EXPECT_EQ(p->error(), "1:24: expected '<' for multisampled texture type");
}
TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingGreaterThan) {
@ -263,8 +261,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan) {
EXPECT_EQ(t.value, nullptr);
EXPECT_FALSE(t.matched);
EXPECT_TRUE(t.errored);
EXPECT_EQ(p->error(),
"1:19: expected '< (opening template argument list)' for storage texture type");
EXPECT_EQ(p->error(), "1:19: expected '<' for storage texture type");
}
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingGreaterThan) {

View File

@ -222,7 +222,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingLessThan) {
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:5: expected '< (opening template argument list)' for ptr declaration");
ASSERT_EQ(p->error(), "1:5: expected '<' for ptr declaration");
}
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingGreaterThanAfterType) {
@ -262,8 +262,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingCommaAfterAccess) {
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(),
"1:19: expected '> (closing template argument list)' for ptr declaration");
ASSERT_EQ(p->error(), "1:19: expected '>' for ptr declaration");
}
TEST_F(ParserImplTest, TypeDecl_Ptr_MissingAddressSpace) {
@ -371,8 +370,7 @@ TEST_F(ParserImplTest, TypeDecl_Atomic_MissingLessThan) {
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(),
"1:8: expected '< (opening template argument list)' for atomic declaration");
ASSERT_EQ(p->error(), "1:8: expected '<' for atomic declaration");
}
TEST_F(ParserImplTest, TypeDecl_Atomic_MissingGreaterThan) {
@ -573,8 +571,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_MissingComma) {
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(),
"1:11: expected '> (closing template argument list)' for array declaration");
ASSERT_EQ(p->error(), "1:11: expected '>' for array declaration");
}
struct MatrixData {

View File

@ -213,7 +213,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingLessThan) {
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(), "1:5: expected '< (opening template argument list)' for ptr declaration");
ASSERT_EQ(p->error(), "1:5: expected '<' for ptr declaration");
}
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingGreaterThanAfterType) {
@ -253,8 +253,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingCommaAfterAccess) {
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(),
"1:19: expected '> (closing template argument list)' for ptr declaration");
ASSERT_EQ(p->error(), "1:19: expected '>' for ptr declaration");
}
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingAddressSpace) {
@ -362,8 +361,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingLessThan) {
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(),
"1:8: expected '< (opening template argument list)' for atomic declaration");
ASSERT_EQ(p->error(), "1:8: expected '<' for atomic declaration");
}
TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingGreaterThan) {
@ -564,8 +562,7 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingComma) {
EXPECT_FALSE(t.matched);
ASSERT_EQ(t.value, nullptr);
ASSERT_TRUE(p->has_error());
ASSERT_EQ(p->error(),
"1:11: expected '> (closing template argument list)' for array declaration");
ASSERT_EQ(p->error(), "1:11: expected '>' for array declaration");
}
struct MatrixData {

View File

@ -71,7 +71,6 @@ std::string_view Token::TypeToName(Type type) {
case Token::Type::kEqualEqual:
return "==";
case Token::Type::kTemplateArgsRight:
return "> (closing template argument list)";
case Token::Type::kGreaterThan:
return ">";
case Token::Type::kGreaterThanEqual:
@ -79,7 +78,6 @@ std::string_view Token::TypeToName(Type type) {
case Token::Type::kShiftRight:
return ">>";
case Token::Type::kTemplateArgsLeft:
return "< (opening template argument list)";
case Token::Type::kLessThan:
return "<";
case Token::Type::kLessThanEqual: