tint: Fix const eval unary tests

I broke this in a recent CL:
https://dawn-review.googlesource.com/c/dawn/+/104424

Bug: tint:1709
Change-Id: I930a57bae723e18708d4f746ed66d24378518df4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105461
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Antonio Maiorano 2022-10-11 21:29:28 +00:00 committed by Dawn LUCI CQ
parent 75bc93c0df
commit 2ad747dedd
1 changed files with 6 additions and 4 deletions

View File

@ -3280,12 +3280,14 @@ TEST_P(ResolverConstEvalUnaryOpTest, Test) {
using T = typename std::decay_t<decltype(expected)>::ElementType;
auto* input_expr = std::visit([&](auto&& value) { return value.Expr(*this); }, c.input);
auto* expected_expr = create<ast::UnaryOpExpression>(op, input_expr);
GlobalConst("C", expected_expr);
auto* expr = create<ast::UnaryOpExpression>(op, input_expr);
EXPECT_TRUE(r()->Resolve()) << r()->error();
GlobalConst("C", expr);
auto* expected_expr = expected.Expr(*this);
GlobalConst("E", expected_expr);
ASSERT_TRUE(r()->Resolve()) << r()->error();
auto* sem = Sem().Get(expected_expr);
auto* sem = Sem().Get(expr);
const sem::Constant* value = sem->ConstantValue();
ASSERT_NE(value, nullptr);
EXPECT_TYPE(value->Type(), sem->Type());