From fd387a37c3b936a547288347bf854405ca2ec647 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Mon, 6 Mar 2023 14:03:08 +0000 Subject: [PATCH] tint: Fix WGSL emission of const_assert Fixed: tint:1858 Change-Id: I5cd2fc4d7dc0a9a0bd48330366a99dd726e42659 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122661 Commit-Queue: Dan Sinclair Kokoro: Kokoro Reviewed-by: Dan Sinclair --- src/tint/writer/wgsl/generator_impl.cc | 2 +- src/tint/writer/wgsl/generator_impl_const_assert_test.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tint/writer/wgsl/generator_impl.cc b/src/tint/writer/wgsl/generator_impl.cc index c0520754f8..69aaabd05a 100644 --- a/src/tint/writer/wgsl/generator_impl.cc +++ b/src/tint/writer/wgsl/generator_impl.cc @@ -1149,7 +1149,7 @@ bool GeneratorImpl::EmitReturn(const ast::ReturnStatement* stmt) { bool GeneratorImpl::EmitConstAssert(const ast::ConstAssert* stmt) { auto out = line(); - out << "static_assert "; + out << "const_assert "; if (!EmitExpression(out, stmt->condition)) { return false; } diff --git a/src/tint/writer/wgsl/generator_impl_const_assert_test.cc b/src/tint/writer/wgsl/generator_impl_const_assert_test.cc index 9f76d65a29..b7853570c6 100644 --- a/src/tint/writer/wgsl/generator_impl_const_assert_test.cc +++ b/src/tint/writer/wgsl/generator_impl_const_assert_test.cc @@ -27,7 +27,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalConstAssert) { GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_EQ(gen.result(), R"(static_assert true; + EXPECT_EQ(gen.result(), R"(const_assert true; )"); } @@ -38,7 +38,7 @@ TEST_F(WgslGeneratorImplTest, Emit_FunctionConstAssert) { ASSERT_TRUE(gen.Generate()) << gen.error(); EXPECT_EQ(gen.result(), R"(fn f() { - static_assert true; + const_assert true; } )"); }