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

View File

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

View File

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

View File

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

View File

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