[validation] Update switch error numbers
fix clang error
Bug: tint: 6
Change-Id: Ib387258387e1f5069585a7fe3af3990df6fc8ddd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29043
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
diff --git a/src/validator_control_block_test.cc b/src/validator_control_block_test.cc
index 9cbfb76..da45cc1 100644
--- a/src/validator_control_block_test.cc
+++ b/src/validator_control_block_test.cc
@@ -64,7 +64,7 @@
EXPECT_TRUE(td()->DetermineStatements(block.get())) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block.get()));
EXPECT_EQ(v()->error(),
- "12:34: v-switch01: switch statement selector expression must be "
+ "12:34: v-0025: switch statement selector expression must be "
"of a scalar integer type");
}
@@ -177,7 +177,7 @@
EXPECT_TRUE(td()->DetermineStatements(block.get())) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block.get()));
EXPECT_EQ(v()->error(),
- "12:34: v-switch03: the case selector values must have the same "
+ "12:34: v-0026: the case selector values must have the same "
"type as the selector expression.");
}
@@ -216,7 +216,7 @@
EXPECT_TRUE(td()->DetermineStatements(block.get())) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block.get()));
EXPECT_EQ(v()->error(),
- "12:34: v-switch03: the case selector values must have the same "
+ "12:34: v-0026: the case selector values must have the same "
"type as the selector expression.");
}
@@ -261,7 +261,7 @@
EXPECT_TRUE(td()->DetermineStatements(block.get())) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block.get()));
EXPECT_EQ(v()->error(),
- "12:34: v-switch04: a literal value must not appear more than once "
+ "12:34: v-0027: a literal value must not appear more than once "
"in the case selectors for a switch statement: '2'");
}
@@ -307,10 +307,9 @@
EXPECT_TRUE(td()->DetermineStatements(block.get())) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block.get()));
- EXPECT_EQ(
- v()->error(),
- "12:34: v-switch04: a literal value must not appear more than once in "
- "the case selectors for a switch statement: '10'");
+ EXPECT_EQ(v()->error(),
+ "12:34: v-0027: a literal value must not appear more than once in "
+ "the case selectors for a switch statement: '10'");
}
TEST_F(ValidateControlBlockTest, LastClauseLastStatementIsFallthrough_Fail) {
@@ -341,7 +340,7 @@
EXPECT_TRUE(td()->DetermineStatements(block.get())) << td()->error();
EXPECT_FALSE(v()->ValidateStatements(block.get()));
EXPECT_EQ(v()->error(),
- "12:34: v-switch05: a fallthrough statement must not appear as the "
+ "12:34: v-0028: a fallthrough statement must not appear as the "
"last statement in last clause of a switch");
}
diff --git a/src/validator_impl.cc b/src/validator_impl.cc
index a7e58d1..624793c 100644
--- a/src/validator_impl.cc
+++ b/src/validator_impl.cc
@@ -250,7 +250,7 @@
auto* cond_type = s->condition()->result_type()->UnwrapAliasPtrAlias();
if (!(cond_type->IsI32() || cond_type->IsU32())) {
set_error(s->condition()->source(),
- "v-switch01: switch statement selector expression must be of a "
+ "v-0025: switch statement selector expression must be of a "
"scalar integer type");
return false;
}
@@ -270,7 +270,7 @@
auto* selector_ptr = selector.get();
if (cond_type != selector_ptr->type()) {
set_error(case_stmt.get()->source(),
- "v-switch03: the case selector values must have the same "
+ "v-0026: the case selector values must have the same "
"type as the selector expression.");
return false;
}
@@ -282,11 +282,10 @@
auto v_str = selector_ptr->type()->IsU32()
? selector_ptr->AsUint()->to_str()
: selector_ptr->AsSint()->to_str();
- set_error(
- case_stmt.get()->source(),
- "v-switch04: a literal value must not appear more than once in "
- "the case selectors for a switch statement: '" +
- v_str + "'");
+ set_error(case_stmt.get()->source(),
+ "v-0027: a literal value must not appear more than once in "
+ "the case selectors for a switch statement: '" +
+ v_str + "'");
return false;
}
selector_set.emplace(v);
@@ -303,7 +302,7 @@
auto* last_stmt_of_last_clause = last_clause->AsCase()->body()->last();
if (last_stmt_of_last_clause && last_stmt_of_last_clause->IsFallthrough()) {
set_error(last_stmt_of_last_clause->source(),
- "v-switch05: a fallthrough statement must not appear as "
+ "v-0028: a fallthrough statement must not appear as "
"the last statement in last clause of a switch");
return false;
}