[tint] Replace 'break-if' with 'break if' in diagnostic.
The diagnostic looks like it's suggesting the fix, but `break-if` won't
compile.
Change-Id: Ibc4fcbb62138f8e4a0548d62a02f0f4f356d6296
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/177803
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/wgsl/resolver/validation_test.cc b/src/tint/lang/wgsl/resolver/validation_test.cc
index db92d22..2e88cc0 100644
--- a/src/tint/lang/wgsl/resolver/validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/validation_test.cc
@@ -1017,9 +1017,9 @@
// }
WrapInFunction(Loop(Block(), cont));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: `break` must not be used to exit from a continuing block. "
- "Use `break-if` instead.");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
}
TEST_F(ResolverValidationTest, Stmt_BreakInIfElseInContinuing) {
@@ -1031,9 +1031,9 @@
// }
WrapInFunction(Loop(Block(), cont));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: `break` must not be used to exit from a continuing block. "
- "Use `break-if` instead.");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
}
TEST_F(ResolverValidationTest, Stmt_BreakInContinuing) {
@@ -1042,9 +1042,9 @@
// }
WrapInFunction(Loop(Block(), cont));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: `break` must not be used to exit from a continuing block. "
- "Use `break-if` instead.");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
}
TEST_F(ResolverValidationTest, Stmt_BreakInIfInIfInContinuing) {
@@ -1057,9 +1057,9 @@
// }
WrapInFunction(Loop(Block(), cont));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: `break` must not be used to exit from a continuing block. "
- "Use `break-if` instead.");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
}
TEST_F(ResolverValidationTest, Stmt_BreakInIfTrueMultipleStmtsInContinuing) {
@@ -1071,9 +1071,9 @@
// }
WrapInFunction(Loop(Block(), cont));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: `break` must not be used to exit from a continuing block. "
- "Use `break-if` instead.");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
}
TEST_F(ResolverValidationTest, Stmt_BreakInIfElseMultipleStmtsInContinuing) {
@@ -1086,9 +1086,9 @@
// }
WrapInFunction(Loop(Block(), cont));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: `break` must not be used to exit from a continuing block. "
- "Use `break-if` instead.");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
}
TEST_F(ResolverValidationTest, Stmt_BreakInIfElseIfInContinuing) {
@@ -1100,9 +1100,9 @@
// }
WrapInFunction(Loop(Block(), cont));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: `break` must not be used to exit from a continuing block. "
- "Use `break-if` instead.");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
}
TEST_F(ResolverValidationTest, Stmt_BreakInIfNonEmptyElseInContinuing) {
@@ -1115,9 +1115,9 @@
// }
WrapInFunction(Loop(Block(), cont));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: `break` must not be used to exit from a continuing block. "
- "Use `break-if` instead.");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
}
TEST_F(ResolverValidationTest, Stmt_BreakInIfElseNonEmptyTrueInContinuing) {
@@ -1130,9 +1130,9 @@
// }
WrapInFunction(Loop(Block(), cont));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: `break` must not be used to exit from a continuing block. "
- "Use `break-if` instead.");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
}
TEST_F(ResolverValidationTest, Stmt_BreakInIfInContinuingNotLast) {
@@ -1144,9 +1144,9 @@
// }
WrapInFunction(Loop(Block(), cont));
EXPECT_FALSE(r()->Resolve());
- EXPECT_EQ(r()->error(),
- "12:34 error: `break` must not be used to exit from a continuing block. "
- "Use `break-if` instead.");
+ EXPECT_EQ(
+ r()->error(),
+ R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
}
TEST_F(ResolverValidationTest, Stmt_BreakNotInLoopOrSwitch) {
diff --git a/src/tint/lang/wgsl/resolver/validator.cc b/src/tint/lang/wgsl/resolver/validator.cc
index 5ac7cf7..adc0134 100644
--- a/src/tint/lang/wgsl/resolver/validator.cc
+++ b/src/tint/lang/wgsl/resolver/validator.cc
@@ -1575,8 +1575,8 @@
if (ClosestContinuing(/*stop_at_loop*/ true, /* stop_at_switch */ true, current_statement) !=
nullptr) {
AddError(stmt->Declaration()->source)
- << "`break` must not be used to exit from a continuing block. Use "
- "`break-if` instead.";
+ << style::Keyword("break") << " must not be used to exit from a continuing block. Use "
+ << style::Keyword("break if") << " instead.";
return false;
}
return true;