mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
Add unit test to check LHS is not an intrinsic function name
Identifiers cannot be assigned. Bug: tint:203 Change-Id: Ibe34749264024b690d8a8bd271304f425a2688ed Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54080 Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
This commit is contained in:
@@ -141,6 +141,19 @@ TEST_F(ResolverValidationTest, Expr_DontCall_Intrinsic) {
|
||||
EXPECT_EQ(r()->error(), "3:8 error: missing '(' for intrinsic call");
|
||||
}
|
||||
|
||||
TEST_F(ResolverValidationTest,
|
||||
AssignmentStmt_InvalidLHS_IntrinsicFunctionName) {
|
||||
// normalize = 2;
|
||||
|
||||
auto* lhs = Expr(Source{{12, 34}}, "normalize");
|
||||
auto* rhs = Expr(2);
|
||||
auto* assign = Assign(lhs, rhs);
|
||||
WrapInFunction(assign);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing '(' for intrinsic call");
|
||||
}
|
||||
|
||||
TEST_F(ResolverValidationTest, UsingUndefinedVariable_Fail) {
|
||||
// b = 2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user