Validator: Change the error message for v-0031 It previously said: "a struct containing a runtime-sized array must be in the 'storage' storage class" This had be looking at the variable's storage class, when the error was actually trying to tell me I needed `[[block]]` on the struct declaration. Change-Id: I7a23a0c0c35508bdac20c808d2635592638dfa77 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/40602 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
diff --git a/src/validator/validator_impl.cc b/src/validator/validator_impl.cc index 16da3e3..ecad8ef 100644 --- a/src/validator/validator_impl.cc +++ b/src/validator/validator_impl.cc
@@ -318,9 +318,9 @@ return false; } if (!st->IsBlockDecorated()) { - add_error(member->source(), "v-0031", + add_error(member->source(), "v-0015", "a struct containing a runtime-sized array " - "must be in the 'storage' storage class: '" + + "requires the [[block]] attribute: '" + program_->Symbols().NameFor(st->symbol()) + "'"); return false; }
diff --git a/src/validator/validator_type_test.cc b/src/validator/validator_type_test.cc index 306182a..5f136ea 100644 --- a/src/validator/validator_type_test.cc +++ b/src/validator/validator_type_test.cc
@@ -79,8 +79,8 @@ EXPECT_FALSE(v.ValidateConstructedTypes(program->AST().ConstructedTypes())); EXPECT_EQ(v.error(), - "v-0031: a struct containing a runtime-sized array must be " - "in the 'storage' storage class: 'Foo'"); + "v-0015: a struct containing a runtime-sized array requires the " + "[[block]] attribute: 'Foo'"); } TEST_F(ValidatorTypeTest, RuntimeArrayIsNotLast_Fail) {