[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>
This commit is contained in:
parent
00000b57e8
commit
60a272a86e
|
@ -64,7 +64,7 @@ TEST_F(ValidateControlBlockTest, SwitchSelectorExpressionNoneIntegerType_Fail) {
|
|||
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 @@ TEST_F(ValidateControlBlockTest,
|
|||
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 @@ TEST_F(ValidateControlBlockTest,
|
|||
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 @@ TEST_F(ValidateControlBlockTest, NonUniqueCaseSelectorValueUint_Fail) {
|
|||
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,9 +307,8 @@ TEST_F(ValidateControlBlockTest, NonUniqueCaseSelectorValueSint_Fail) {
|
|||
|
||||
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 "
|
||||
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'");
|
||||
}
|
||||
|
||||
|
@ -341,7 +340,7 @@ TEST_F(ValidateControlBlockTest, LastClauseLastStatementIsFallthrough_Fail) {
|
|||
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");
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ bool ValidatorImpl::ValidateSwitch(const ast::SwitchStatement* s) {
|
|||
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 @@ bool ValidatorImpl::ValidateSwitch(const ast::SwitchStatement* s) {
|
|||
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,9 +282,8 @@ bool ValidatorImpl::ValidateSwitch(const ast::SwitchStatement* s) {
|
|||
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 "
|
||||
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;
|
||||
|
@ -303,7 +302,7 @@ bool ValidatorImpl::ValidateSwitch(const ast::SwitchStatement* s) {
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue