diff --git a/src/validator_control_block_test.cc b/src/validator_control_block_test.cc index 9cbfb76c0e..da45cc1423 100644 --- a/src/validator_control_block_test.cc +++ b/src/validator_control_block_test.cc @@ -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,10 +307,9 @@ 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 " - "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 @@ 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"); } diff --git a/src/validator_impl.cc b/src/validator_impl.cc index a7e58d15cb..624793c98b 100644 --- a/src/validator_impl.cc +++ b/src/validator_impl.cc @@ -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,11 +282,10 @@ 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 " - "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 @@ 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; }