From 5addefb1488d4896f9eb3eef6ddd106d10ff7c84 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Wed, 14 Dec 2022 20:46:32 +0000 Subject: [PATCH] Rename Constant::As to Constant::ValueAs. This CL updates Constant::As to be Constant::ValueAs. Now that Constant inherits from CastableBase, there is already an As method on CastableBase. This makes the override inside Constant confusing and potentially incorrect. Bug: tint:1718 Change-Id: I4f73971801e95225a99a5a993124c04194d0d7d6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114360 Reviewed-by: Ben Clayton Commit-Queue: Dan Sinclair Kokoro: Dan Sinclair --- src/tint/constant/constant.h | 2 +- src/tint/inspector/inspector.cc | 8 +- src/tint/resolver/const_eval.cc | 128 ++--- .../resolver/const_eval_binary_op_test.cc | 10 +- .../resolver/const_eval_construction_test.cc | 444 +++++++++--------- .../resolver/const_eval_conversion_test.cc | 48 +- src/tint/resolver/const_eval_indexing_test.cc | 40 +- .../resolver/const_eval_member_access_test.cc | 8 +- src/tint/resolver/const_eval_test.h | 14 +- src/tint/resolver/const_eval_unary_op_test.cc | 2 +- src/tint/resolver/resolver.cc | 30 +- src/tint/resolver/validator.cc | 6 +- src/tint/resolver/variable_test.cc | 8 +- src/tint/transform/direct_variable_access.cc | 2 +- src/tint/transform/std140.cc | 2 +- .../transform/zero_init_workgroup_memory.cc | 2 +- src/tint/writer/glsl/generator_impl.cc | 10 +- src/tint/writer/hlsl/generator_impl.cc | 12 +- src/tint/writer/msl/generator_impl.cc | 12 +- src/tint/writer/spirv/builder.cc | 14 +- 20 files changed, 401 insertions(+), 401 deletions(-) diff --git a/src/tint/constant/constant.h b/src/tint/constant/constant.h index bd60f49a01..f9124efc51 100644 --- a/src/tint/constant/constant.h +++ b/src/tint/constant/constant.h @@ -62,7 +62,7 @@ class Constant : public Castable { /// @returns the value of the constant as the given scalar or abstract value. template - T As() const { + T ValueAs() const { return std::visit( [](auto v) { if constexpr (std::is_same_v) { diff --git a/src/tint/inspector/inspector.cc b/src/tint/inspector/inspector.cc index 647d14ef82..75c4863c73 100644 --- a/src/tint/inspector/inspector.cc +++ b/src/tint/inspector/inspector.cc @@ -314,10 +314,10 @@ std::map Inspector::GetOverrideDefaultValues() { if (auto* value = global->Initializer()->ConstantValue()) { result[override_id] = Switch( value->Type(), // - [&](const type::I32*) { return Scalar(value->As()); }, - [&](const type::U32*) { return Scalar(value->As()); }, - [&](const type::F32*) { return Scalar(value->As()); }, - [&](const type::Bool*) { return Scalar(value->As()); }); + [&](const type::I32*) { return Scalar(value->ValueAs()); }, + [&](const type::U32*) { return Scalar(value->ValueAs()); }, + [&](const type::F32*) { return Scalar(value->ValueAs()); }, + [&](const type::Bool*) { return Scalar(value->ValueAs()); }); continue; } } diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc index 0481b4a15f..434a7659ad 100644 --- a/src/tint/resolver/const_eval.cc +++ b/src/tint/resolver/const_eval.cc @@ -64,8 +64,8 @@ template auto Dispatch_iu32(F&& f, CONSTANTS&&... cs) { return Switch( First(cs...)->Type(), // - [&](const type::I32*) { return f(cs->template As()...); }, - [&](const type::U32*) { return f(cs->template As()...); }); + [&](const type::I32*) { return f(cs->template ValueAs()...); }, + [&](const type::U32*) { return f(cs->template ValueAs()...); }); } /// Helper that calls `f` passing in the value of all `cs`. @@ -74,9 +74,9 @@ template auto Dispatch_ia_iu32(F&& f, CONSTANTS&&... cs) { return Switch( First(cs...)->Type(), // - [&](const type::AbstractInt*) { return f(cs->template As()...); }, - [&](const type::I32*) { return f(cs->template As()...); }, - [&](const type::U32*) { return f(cs->template As()...); }); + [&](const type::AbstractInt*) { return f(cs->template ValueAs()...); }, + [&](const type::I32*) { return f(cs->template ValueAs()...); }, + [&](const type::U32*) { return f(cs->template ValueAs()...); }); } /// Helper that calls `f` passing in the value of all `cs`. @@ -85,10 +85,10 @@ template auto Dispatch_ia_iu32_bool(F&& f, CONSTANTS&&... cs) { return Switch( First(cs...)->Type(), // - [&](const type::AbstractInt*) { return f(cs->template As()...); }, - [&](const type::I32*) { return f(cs->template As()...); }, - [&](const type::U32*) { return f(cs->template As()...); }, - [&](const type::Bool*) { return f(cs->template As()...); }); + [&](const type::AbstractInt*) { return f(cs->template ValueAs()...); }, + [&](const type::I32*) { return f(cs->template ValueAs()...); }, + [&](const type::U32*) { return f(cs->template ValueAs()...); }, + [&](const type::Bool*) { return f(cs->template ValueAs()...); }); } /// Helper that calls `f` passing in the value of all `cs`. @@ -97,11 +97,11 @@ template auto Dispatch_fia_fi32_f16(F&& f, CONSTANTS&&... cs) { return Switch( First(cs...)->Type(), // - [&](const type::AbstractInt*) { return f(cs->template As()...); }, - [&](const type::AbstractFloat*) { return f(cs->template As()...); }, - [&](const type::F32*) { return f(cs->template As()...); }, - [&](const type::I32*) { return f(cs->template As()...); }, - [&](const type::F16*) { return f(cs->template As()...); }); + [&](const type::AbstractInt*) { return f(cs->template ValueAs()...); }, + [&](const type::AbstractFloat*) { return f(cs->template ValueAs()...); }, + [&](const type::F32*) { return f(cs->template ValueAs()...); }, + [&](const type::I32*) { return f(cs->template ValueAs()...); }, + [&](const type::F16*) { return f(cs->template ValueAs()...); }); } /// Helper that calls `f` passing in the value of all `cs`. @@ -110,12 +110,12 @@ template auto Dispatch_fia_fiu32_f16(F&& f, CONSTANTS&&... cs) { return Switch( First(cs...)->Type(), // - [&](const type::AbstractInt*) { return f(cs->template As()...); }, - [&](const type::AbstractFloat*) { return f(cs->template As()...); }, - [&](const type::F32*) { return f(cs->template As()...); }, - [&](const type::I32*) { return f(cs->template As()...); }, - [&](const type::U32*) { return f(cs->template As()...); }, - [&](const type::F16*) { return f(cs->template As()...); }); + [&](const type::AbstractInt*) { return f(cs->template ValueAs()...); }, + [&](const type::AbstractFloat*) { return f(cs->template ValueAs()...); }, + [&](const type::F32*) { return f(cs->template ValueAs()...); }, + [&](const type::I32*) { return f(cs->template ValueAs()...); }, + [&](const type::U32*) { return f(cs->template ValueAs()...); }, + [&](const type::F16*) { return f(cs->template ValueAs()...); }); } /// Helper that calls `f` passing in the value of all `cs`. @@ -124,13 +124,13 @@ template auto Dispatch_fia_fiu32_f16_bool(F&& f, CONSTANTS&&... cs) { return Switch( First(cs...)->Type(), // - [&](const type::AbstractInt*) { return f(cs->template As()...); }, - [&](const type::AbstractFloat*) { return f(cs->template As()...); }, - [&](const type::F32*) { return f(cs->template As()...); }, - [&](const type::I32*) { return f(cs->template As()...); }, - [&](const type::U32*) { return f(cs->template As()...); }, - [&](const type::F16*) { return f(cs->template As()...); }, - [&](const type::Bool*) { return f(cs->template As()...); }); + [&](const type::AbstractInt*) { return f(cs->template ValueAs()...); }, + [&](const type::AbstractFloat*) { return f(cs->template ValueAs()...); }, + [&](const type::F32*) { return f(cs->template ValueAs()...); }, + [&](const type::I32*) { return f(cs->template ValueAs()...); }, + [&](const type::U32*) { return f(cs->template ValueAs()...); }, + [&](const type::F16*) { return f(cs->template ValueAs()...); }, + [&](const type::Bool*) { return f(cs->template ValueAs()...); }); } /// Helper that calls `f` passing in the value of all `cs`. @@ -139,16 +139,16 @@ template auto Dispatch_fa_f32_f16(F&& f, CONSTANTS&&... cs) { return Switch( First(cs...)->Type(), // - [&](const type::AbstractFloat*) { return f(cs->template As()...); }, - [&](const type::F32*) { return f(cs->template As()...); }, - [&](const type::F16*) { return f(cs->template As()...); }); + [&](const type::AbstractFloat*) { return f(cs->template ValueAs()...); }, + [&](const type::F32*) { return f(cs->template ValueAs()...); }, + [&](const type::F16*) { return f(cs->template ValueAs()...); }); } /// Helper that calls `f` passing in the value of all `cs`. /// Calls `f` with all constants cast to the type of the first `cs` argument. template auto Dispatch_bool(F&& f, CONSTANTS&&... cs) { - return f(cs->template As()...); + return f(cs->template ValueAs()...); } /// ZeroTypeDispatch is a helper for calling the function `f`, passing a single zero-value argument @@ -1373,7 +1373,7 @@ ConstEval::Result ConstEval::Index(const sem::Expression* obj_expr, uint32_t el_count = 0; type::Type::ElementOf(obj_expr->Type()->UnwrapRef(), &el_count); - AInt idx = idx_val->As(); + AInt idx = idx_val->ValueAs(); if (idx < 0 || (el_count > 0 && idx >= el_count)) { std::string range; if (el_count > 0) { @@ -1761,7 +1761,7 @@ ConstEval::Result ConstEval::OpLogicalAnd(const type::Type* ty, const Source& source) { // Note: Due to short-circuiting, this function is only called if lhs is true, so we could // technically only return the value of the rhs. - return CreateScalar(builder, source, ty, args[0]->As() && args[1]->As()); + return CreateScalar(builder, source, ty, args[0]->ValueAs() && args[1]->ValueAs()); } ConstEval::Result ConstEval::OpLogicalOr(const type::Type* ty, @@ -1769,7 +1769,7 @@ ConstEval::Result ConstEval::OpLogicalOr(const type::Type* ty, const Source& source) { // Note: Due to short-circuiting, this function is only called if lhs is false, so we could // technically only return the value of the rhs. - return CreateScalar(builder, source, ty, args[1]->As()); + return CreateScalar(builder, source, ty, args[1]->ValueAs()); } ConstEval::Result ConstEval::OpAnd(const type::Type* ty, @@ -2408,8 +2408,8 @@ ConstEval::Result ConstEval::extractBits(const type::Type* ty, using NumberUT = Number; // Read args that are always scalar - NumberUT in_offset = args[1]->As(); - NumberUT in_count = args[2]->As(); + NumberUT in_offset = args[1]->ValueAs(); + NumberUT in_count = args[2]->ValueAs(); // Cast all to unsigned UT e = static_cast(in_e); @@ -2606,7 +2606,7 @@ ConstEval::Result ConstEval::frexp(const type::Type* ty, auto scalar = [&](const constant::Constant* s) { int exp = 0; - double fract = std::frexp(s->As(), &exp); + double fract = std::frexp(s->ValueAs(), &exp); return Switch( s->Type(), [&](const type::F32*) { @@ -2678,8 +2678,8 @@ ConstEval::Result ConstEval::insertBits(const type::Type* ty, using NumberUT = Number; // Read args that are always scalar - NumberUT in_offset = args[2]->As(); - NumberUT in_count = args[3]->As(); + NumberUT in_offset = args[2]->ValueAs(); + NumberUT in_count = args[3]->ValueAs(); // Cast all to unsigned UT e = static_cast(in_e); @@ -2831,9 +2831,9 @@ ConstEval::Result ConstEval::mix(const type::Type* ty, NumberT e3; auto* c2 = args[2]; if (c2->Type()->Is()) { - e3 = c2->Index(index)->As(); + e3 = c2->Index(index)->ValueAs(); } else { - e3 = c2->As(); + e3 = c2->ValueAs(); } // Implement as `e1 * (1 - e3) + e2 * e3)` instead of as `e1 + e3 * (e2 - e1)` to avoid // float precision loss when e1 and e2 significantly differ in magnitude. @@ -2929,12 +2929,12 @@ ConstEval::Result ConstEval::pack2x16float(const type::Type* ty, }; auto* e = args[0]; - auto e0 = convert(e->Index(0)->As()); + auto e0 = convert(e->Index(0)->ValueAs()); if (!e0) { return utils::Failure; } - auto e1 = convert(e->Index(1)->As()); + auto e1 = convert(e->Index(1)->ValueAs()); if (!e1) { return utils::Failure; } @@ -2953,8 +2953,8 @@ ConstEval::Result ConstEval::pack2x16snorm(const type::Type* ty, }; auto* e = args[0]; - auto e0 = calc(e->Index(0)->As()); - auto e1 = calc(e->Index(1)->As()); + auto e0 = calc(e->Index(0)->ValueAs()); + auto e1 = calc(e->Index(1)->ValueAs()); u32 ret = u32((e0 & 0x0000'ffff) | (e1 << 16)); return CreateScalar(builder, source, ty, ret); @@ -2969,8 +2969,8 @@ ConstEval::Result ConstEval::pack2x16unorm(const type::Type* ty, }; auto* e = args[0]; - auto e0 = calc(e->Index(0)->As()); - auto e1 = calc(e->Index(1)->As()); + auto e0 = calc(e->Index(0)->ValueAs()); + auto e1 = calc(e->Index(1)->ValueAs()); u32 ret = u32((e0 & 0x0000'ffff) | (e1 << 16)); return CreateScalar(builder, source, ty, ret); @@ -2986,10 +2986,10 @@ ConstEval::Result ConstEval::pack4x8snorm(const type::Type* ty, }; auto* e = args[0]; - auto e0 = calc(e->Index(0)->As()); - auto e1 = calc(e->Index(1)->As()); - auto e2 = calc(e->Index(2)->As()); - auto e3 = calc(e->Index(3)->As()); + auto e0 = calc(e->Index(0)->ValueAs()); + auto e1 = calc(e->Index(1)->ValueAs()); + auto e2 = calc(e->Index(2)->ValueAs()); + auto e3 = calc(e->Index(3)->ValueAs()); uint32_t mask = 0x0000'00ff; u32 ret = u32((e0 & mask) | ((e1 & mask) << 8) | ((e2 & mask) << 16) | ((e3 & mask) << 24)); @@ -3005,10 +3005,10 @@ ConstEval::Result ConstEval::pack4x8unorm(const type::Type* ty, }; auto* e = args[0]; - auto e0 = calc(e->Index(0)->As()); - auto e1 = calc(e->Index(1)->As()); - auto e2 = calc(e->Index(2)->As()); - auto e3 = calc(e->Index(3)->As()); + auto e0 = calc(e->Index(0)->ValueAs()); + auto e1 = calc(e->Index(1)->ValueAs()); + auto e2 = calc(e->Index(2)->ValueAs()); + auto e3 = calc(e->Index(3)->ValueAs()); uint32_t mask = 0x0000'00ff; u32 ret = u32((e0 & mask) | ((e1 & mask) << 8) | ((e2 & mask) << 16) | ((e3 & mask) << 24)); @@ -3173,7 +3173,7 @@ ConstEval::Result ConstEval::refract(const type::Type* ty, } // If k < 0.0, returns the refraction vector 0.0 - if (k.Get()->As() < 0) { + if (k.Get()->ValueAs() < 0) { return ZeroValue(builder, ty); } @@ -3279,7 +3279,7 @@ ConstEval::Result ConstEval::saturate(const type::Type* ty, ConstEval::Result ConstEval::select_bool(const type::Type* ty, utils::VectorRef args, const Source& source) { - auto cond = args[2]->As(); + auto cond = args[2]->ValueAs(); auto transform = [&](const constant::Constant* c0, const constant::Constant* c1) { auto create = [&](auto f, auto t) -> ConstEval::Result { return CreateScalar(builder, source, type::Type::DeepestElementOf(ty), cond ? t : f); @@ -3296,7 +3296,7 @@ ConstEval::Result ConstEval::select_boolvec(const type::Type* ty, auto transform = [&](const constant::Constant* c0, const constant::Constant* c1, size_t index) { auto create = [&](auto f, auto t) -> ConstEval::Result { // Get corresponding bool value at the current vector value index - auto cond = args[2]->Index(index)->As(); + auto cond = args[2]->Index(index)->ValueAs(); return CreateScalar(builder, source, type::Type::DeepestElementOf(ty), cond ? t : f); }; return Dispatch_fia_fiu32_f16_bool(create, c0, c1); @@ -3490,7 +3490,7 @@ ConstEval::Result ConstEval::unpack2x16float(const type::Type* ty, utils::VectorRef args, const Source& source) { auto* inner_ty = type::Type::DeepestElementOf(ty); - auto e = args[0]->As().value; + auto e = args[0]->ValueAs().value; utils::Vector els; els.Reserve(2); @@ -3514,7 +3514,7 @@ ConstEval::Result ConstEval::unpack2x16snorm(const type::Type* ty, utils::VectorRef args, const Source& source) { auto* inner_ty = type::Type::DeepestElementOf(ty); - auto e = args[0]->As().value; + auto e = args[0]->ValueAs().value; utils::Vector els; els.Reserve(2); @@ -3534,7 +3534,7 @@ ConstEval::Result ConstEval::unpack2x16unorm(const type::Type* ty, utils::VectorRef args, const Source& source) { auto* inner_ty = type::Type::DeepestElementOf(ty); - auto e = args[0]->As().value; + auto e = args[0]->ValueAs().value; utils::Vector els; els.Reserve(2); @@ -3553,7 +3553,7 @@ ConstEval::Result ConstEval::unpack4x8snorm(const type::Type* ty, utils::VectorRef args, const Source& source) { auto* inner_ty = type::Type::DeepestElementOf(ty); - auto e = args[0]->As().value; + auto e = args[0]->ValueAs().value; utils::Vector els; els.Reserve(4); @@ -3573,7 +3573,7 @@ ConstEval::Result ConstEval::unpack4x8unorm(const type::Type* ty, utils::VectorRef args, const Source& source) { auto* inner_ty = type::Type::DeepestElementOf(ty); - auto e = args[0]->As().value; + auto e = args[0]->ValueAs().value; utils::Vector els; els.Reserve(4); @@ -3592,7 +3592,7 @@ ConstEval::Result ConstEval::quantizeToF16(const type::Type* ty, utils::VectorRef args, const Source& source) { auto transform = [&](const constant::Constant* c) -> ConstEval::Result { - auto value = c->As(); + auto value = c->ValueAs(); auto conv = CheckedConvert(f16(value)); if (!conv) { AddError(OverflowErrorMessage(value, "f16"), source); diff --git a/src/tint/resolver/const_eval_binary_op_test.cc b/src/tint/resolver/const_eval_binary_op_test.cc index d626afccd0..0f9e8ef69d 100644 --- a/src/tint/resolver/const_eval_binary_op_test.cc +++ b/src/tint/resolver/const_eval_binary_op_test.cc @@ -903,7 +903,7 @@ TEST_F(ResolverConstEvalTest, NotAndOrOfVecs) { ForEachElemPair(value, expected_value, [&](const constant::Constant* a, const constant::Constant* b) { - EXPECT_EQ(a->As(), b->As()); + EXPECT_EQ(a->ValueAs(), b->ValueAs()); return HasFailure() ? Action::kStop : Action::kContinue; }); } @@ -1377,7 +1377,7 @@ static void ValidateAnd(const sem::Info& sem, const ast::BinaryExpression* binar auto* lhs_sem = sem.Get(lhs); ASSERT_TRUE(lhs_sem->ConstantValue()); - EXPECT_EQ(lhs_sem->ConstantValue()->As(), false); + EXPECT_EQ(lhs_sem->ConstantValue()->ValueAs(), false); EXPECT_EQ(lhs_sem->Stage(), sem::EvaluationStage::kConstant); auto* rhs_sem = sem.Get(rhs); @@ -1386,7 +1386,7 @@ static void ValidateAnd(const sem::Info& sem, const ast::BinaryExpression* binar auto* binary_sem = sem.Get(binary); ASSERT_TRUE(binary_sem->ConstantValue()); - EXPECT_EQ(binary_sem->ConstantValue()->As(), false); + EXPECT_EQ(binary_sem->ConstantValue()->ValueAs(), false); EXPECT_EQ(binary_sem->Stage(), sem::EvaluationStage::kConstant); } @@ -1397,7 +1397,7 @@ static void ValidateOr(const sem::Info& sem, const ast::BinaryExpression* binary auto* lhs_sem = sem.Get(lhs); ASSERT_TRUE(lhs_sem->ConstantValue()); - EXPECT_EQ(lhs_sem->ConstantValue()->As(), true); + EXPECT_EQ(lhs_sem->ConstantValue()->ValueAs(), true); EXPECT_EQ(lhs_sem->Stage(), sem::EvaluationStage::kConstant); auto* rhs_sem = sem.Get(rhs); @@ -1406,7 +1406,7 @@ static void ValidateOr(const sem::Info& sem, const ast::BinaryExpression* binary auto* binary_sem = sem.Get(binary); ASSERT_TRUE(binary_sem->ConstantValue()); - EXPECT_EQ(binary_sem->ConstantValue()->As(), true); + EXPECT_EQ(binary_sem->ConstantValue()->ValueAs(), true); EXPECT_EQ(binary_sem->Stage(), sem::EvaluationStage::kConstant); } diff --git a/src/tint/resolver/const_eval_construction_test.cc b/src/tint/resolver/const_eval_construction_test.cc index 2c3bd9be62..93871b48f7 100644 --- a/src/tint/resolver/const_eval_construction_test.cc +++ b/src/tint/resolver/const_eval_construction_test.cc @@ -32,7 +32,7 @@ TEST_F(ResolverConstEvalTest, Scalar_i32) { EXPECT_TRUE(sem->ConstantValue()->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->AllZero()); - EXPECT_EQ(sem->ConstantValue()->As(), 99); + EXPECT_EQ(sem->ConstantValue()->ValueAs(), 99); } TEST_F(ResolverConstEvalTest, Scalar_u32) { @@ -48,7 +48,7 @@ TEST_F(ResolverConstEvalTest, Scalar_u32) { EXPECT_TRUE(sem->ConstantValue()->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->AllZero()); - EXPECT_EQ(sem->ConstantValue()->As(), 99u); + EXPECT_EQ(sem->ConstantValue()->ValueAs(), 99u); } TEST_F(ResolverConstEvalTest, Scalar_f32) { @@ -64,7 +64,7 @@ TEST_F(ResolverConstEvalTest, Scalar_f32) { EXPECT_TRUE(sem->ConstantValue()->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->AllZero()); - EXPECT_EQ(sem->ConstantValue()->As().value, 9.9f); + EXPECT_EQ(sem->ConstantValue()->ValueAs().value, 9.9f); } TEST_F(ResolverConstEvalTest, Scalar_f16) { @@ -83,7 +83,7 @@ TEST_F(ResolverConstEvalTest, Scalar_f16) { EXPECT_FALSE(sem->ConstantValue()->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->AllZero()); // 9.9 is not exactly representable by f16, and should be quantized to 9.8984375 - EXPECT_EQ(sem->ConstantValue()->As(), 9.8984375f); + EXPECT_EQ(sem->ConstantValue()->ValueAs(), 9.8984375f); } TEST_F(ResolverConstEvalTest, Scalar_bool) { @@ -99,7 +99,7 @@ TEST_F(ResolverConstEvalTest, Scalar_bool) { EXPECT_TRUE(sem->ConstantValue()->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->AllZero()); - EXPECT_EQ(sem->ConstantValue()->As(), true); + EXPECT_EQ(sem->ConstantValue()->ValueAs(), true); } TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_i32) { @@ -122,17 +122,17 @@ TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_i32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 0); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0); } TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_u32) { @@ -155,17 +155,17 @@ TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_u32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0u); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0u); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 0u); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0u); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0u); } TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f32) { @@ -188,17 +188,17 @@ TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0._a); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0._a); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0._a); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 0._a); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0._a); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0._a); } TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f16) { @@ -223,17 +223,17 @@ TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f16) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0._a); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0._a); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0._a); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 0._a); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0._a); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0._a); } TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_bool) { @@ -256,17 +256,17 @@ TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_bool) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), false); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), false); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), false); } TEST_F(ResolverConstEvalTest, Vec3_Splat_i32) { @@ -289,17 +289,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Splat_i32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 99); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 99); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 99); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 99); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 99); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 99); } TEST_F(ResolverConstEvalTest, Vec3_Splat_u32) { @@ -322,17 +322,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Splat_u32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 99u); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 99u); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 99u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 99u); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 99u); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 99u); } TEST_F(ResolverConstEvalTest, Vec3_Splat_f32) { @@ -355,17 +355,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Splat_f32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 9.9f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 9.9f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 9.9f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 9.9f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 9.9f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 9.9f); } TEST_F(ResolverConstEvalTest, Vec3_Splat_f16) { @@ -391,17 +391,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Splat_f16) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 9.8984375f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 9.8984375f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 9.8984375f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 9.8984375f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 9.8984375f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 9.8984375f); } TEST_F(ResolverConstEvalTest, Vec3_Splat_bool) { @@ -424,17 +424,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Splat_bool) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), true); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), true); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), true); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), true); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), true); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), true); } TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_i32) { @@ -457,17 +457,17 @@ TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_i32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3); } TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_u32) { @@ -490,17 +490,17 @@ TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_u32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3); } TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f32) { @@ -523,17 +523,17 @@ TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1.f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1.f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2.f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2.f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3.f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3.f); } TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f16) { @@ -558,17 +558,17 @@ TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f16) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1.f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1.f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2.f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2.f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3.f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3.f); } TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_bool) { @@ -591,17 +591,17 @@ TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_bool) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), true); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), true); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), false); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), true); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), true); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_i32) { @@ -624,17 +624,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_i32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_u32) { @@ -657,17 +657,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_u32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32) { @@ -690,17 +690,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1.f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1.f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2.f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2.f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3.f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3.f); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_all_10) { @@ -723,17 +723,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_all_10) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 10_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 10_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 10_f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 10_f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 10_f); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_all_positive_0) { @@ -756,17 +756,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_all_positive_0) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0_f); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_all_negative_0) { @@ -789,17 +789,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_all_negative_0) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), -0_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), -0_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -0_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), -0_f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), -0_f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), -0_f); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_mixed_sign_0) { @@ -822,17 +822,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_mixed_sign_0) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -0_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), -0_f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0_f); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16) { @@ -857,17 +857,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1.f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1.f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2.f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2.f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3.f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3.f); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_10) { @@ -892,17 +892,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_10) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10_h); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 10_h); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 10_h); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 10_h); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 10_h); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 10_h); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_positive_0) { @@ -927,17 +927,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_positive_0) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_h); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0_h); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_h); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 0_h); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_h); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0_h); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_negative_0) { @@ -962,17 +962,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_negative_0) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), -0_h); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), -0_h); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -0_h); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), -0_h); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), -0_h); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), -0_h); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_mixed_sign_0) { @@ -997,17 +997,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_mixed_sign_0) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_h); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0_h); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -0_h); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), -0_h); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_h); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0_h); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_bool) { @@ -1030,17 +1030,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_bool) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), true); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), true); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), false); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), true); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), true); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_all_true) { @@ -1063,17 +1063,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_all_true) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), true); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), true); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), true); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), true); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), true); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), true); } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_all_false) { @@ -1096,17 +1096,17 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_all_false) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), false); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), false); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), false); } TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f32) { @@ -1130,32 +1130,32 @@ TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 0._f); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 0._f); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->ValueAs(), 0._f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 0._f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 0._f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs(), 0._f); } TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f16) { @@ -1181,32 +1181,32 @@ TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f16) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 0._h); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 0._h); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->ValueAs(), 0._h); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 0._h); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 0._h); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs(), 0._h); } TEST_F(ResolverConstEvalTest, Mat3x2_Construct_Scalars_af) { @@ -1230,32 +1230,32 @@ TEST_F(ResolverConstEvalTest, Mat3x2_Construct_Scalars_af) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1._a); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 1._a); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2._a); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 2._a); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 3._a); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 3._a); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 4._a); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 4._a); EXPECT_TRUE(sem->ConstantValue()->Index(2)->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->As(), 5._a); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->ValueAs(), 5._a); EXPECT_TRUE(sem->ConstantValue()->Index(2)->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->As(), 6._a); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->ValueAs(), 6._a); } TEST_F(ResolverConstEvalTest, Mat3x2_Construct_Columns_af) { @@ -1282,32 +1282,32 @@ TEST_F(ResolverConstEvalTest, Mat3x2_Construct_Columns_af) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1._a); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 1._a); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2._a); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 2._a); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 3._a); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 3._a); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 4._a); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 4._a); EXPECT_TRUE(sem->ConstantValue()->Index(2)->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->As(), 5._a); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->ValueAs(), 5._a); EXPECT_TRUE(sem->ConstantValue()->Index(2)->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->As(), 6._a); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->ValueAs(), 6._a); } TEST_F(ResolverConstEvalTest, Array_i32_Zero) { @@ -1329,22 +1329,22 @@ TEST_F(ResolverConstEvalTest, Array_i32_Zero) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0_i); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 0_i); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0_i); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(3)->ValueAs(), 0_i); } TEST_F(ResolverConstEvalTest, Array_f32_Zero) { @@ -1366,22 +1366,22 @@ TEST_F(ResolverConstEvalTest, Array_f32_Zero) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(3)->ValueAs(), 0_f); } TEST_F(ResolverConstEvalTest, Array_vec3_f32_Zero) { @@ -1403,32 +1403,32 @@ TEST_F(ResolverConstEvalTest, Array_vec3_f32_Zero) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs(), 0_f); } TEST_F(ResolverConstEvalTest, Array_Struct_f32_Zero) { @@ -1454,22 +1454,22 @@ TEST_F(ResolverConstEvalTest, Array_Struct_f32_Zero) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 0_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 0_f); } TEST_F(ResolverConstEvalTest, Array_i32_Elements) { @@ -1491,22 +1491,22 @@ TEST_F(ResolverConstEvalTest, Array_i32_Elements) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 10_i); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 20_i); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 20_i); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 30_i); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 30_i); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(3)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(3)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 40_i); + EXPECT_EQ(sem->ConstantValue()->Index(3)->ValueAs(), 40_i); } TEST_F(ResolverConstEvalTest, Array_f32_Elements) { @@ -1528,22 +1528,22 @@ TEST_F(ResolverConstEvalTest, Array_f32_Elements) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 10_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 20_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 20_f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 30_f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 30_f); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(3)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(3)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 40_f); + EXPECT_EQ(sem->ConstantValue()->Index(3)->ValueAs(), 40_f); } TEST_F(ResolverConstEvalTest, Array_vec3_f32_Elements) { @@ -1562,12 +1562,12 @@ TEST_F(ResolverConstEvalTest, Array_vec3_f32_Elements) { EXPECT_FALSE(sem->ConstantValue()->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1_f); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2_f); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 3_f); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 4_f); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 5_f); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 6_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 1_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 2_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->ValueAs(), 3_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 4_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 5_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs(), 6_f); } TEST_F(ResolverConstEvalTest, Array_Struct_f32_Elements) { @@ -1595,22 +1595,22 @@ TEST_F(ResolverConstEvalTest, Array_Struct_f32_Elements) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 1_f); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 2_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 3_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 3_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 4_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 4_f); } TEST_F(ResolverConstEvalTest, Struct_I32s_ZeroInit) { @@ -1636,19 +1636,19 @@ TEST_F(ResolverConstEvalTest, Struct_I32s_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0_i); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 0_i); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0_i); } TEST_F(ResolverConstEvalTest, Struct_MixedScalars_ZeroInit) { @@ -1681,31 +1681,31 @@ TEST_F(ResolverConstEvalTest, Struct_MixedScalars_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0_i); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 0_u); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0._f); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->ValueAs(), 0._h); EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(4)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(4)->ValueAs(), false); } TEST_F(ResolverConstEvalTest, Struct_VectorF32s_ZeroInit) { @@ -1736,9 +1736,9 @@ TEST_F(ResolverConstEvalTest, Struct_VectorF32s_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(0)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0._f); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0._f); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->ValueAs(), 0._f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); @@ -1746,9 +1746,9 @@ TEST_F(ResolverConstEvalTest, Struct_VectorF32s_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(1)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0._f); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0._f); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs(), 0._f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); @@ -1756,9 +1756,9 @@ TEST_F(ResolverConstEvalTest, Struct_VectorF32s_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(2)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->As(), 0._f); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->As(), 0._f); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->ValueAs(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->ValueAs(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->ValueAs(), 0._f); } TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) { @@ -1793,8 +1793,8 @@ TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(0)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0_i); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 0_i); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); @@ -1802,9 +1802,9 @@ TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(1)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0_u); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0_u); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs(), 0_u); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); @@ -1812,10 +1812,10 @@ TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(2)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->As(), 0._f); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->As(), 0._f); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->As(), 0._f); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(3)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->ValueAs(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->ValueAs(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->ValueAs(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(3)->ValueAs(), 0._f); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AnyZero()); @@ -1823,9 +1823,9 @@ TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(3)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(0)->As(), 0._h); - EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(1)->As(), 0._h); - EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(2)->As(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(0)->ValueAs(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(1)->ValueAs(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(2)->ValueAs(), 0._h); EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero()); @@ -1833,8 +1833,8 @@ TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(4)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(0)->As(), false); - EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(1)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(0)->ValueAs(), false); + EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(1)->ValueAs(), false); } TEST_F(ResolverConstEvalTest, Struct_Struct_ZeroInit) { @@ -1868,17 +1868,17 @@ TEST_F(ResolverConstEvalTest, Struct_Struct_ZeroInit) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0_i); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0_u); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->ValueAs(), 0_f); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0_i); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0_u); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs(), 0_f); } TEST_F(ResolverConstEvalTest, Struct_MixedScalars_Construct) { @@ -1911,31 +1911,31 @@ TEST_F(ResolverConstEvalTest, Struct_MixedScalars_Construct) { EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1_i); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2_u); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3._f); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(3)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(3)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 4._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->ValueAs(), 4._h); EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(4)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(4)->ValueAs(), false); } TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) { @@ -1971,8 +1971,8 @@ TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(0)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1_i); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 1_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 1_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 1_i); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); @@ -1980,9 +1980,9 @@ TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) { EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(1)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 2_u); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 2_u); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 2_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 2_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 2_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs(), 2_u); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); @@ -1990,10 +1990,10 @@ TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) { EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(2)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->As(), 3._f); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->As(), 3._f); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->As(), 3._f); - EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(3)->As(), 3._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->ValueAs(), 3._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->ValueAs(), 3._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->ValueAs(), 3._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(3)->ValueAs(), 3._f); EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(3)->AnyZero()); @@ -2001,9 +2001,9 @@ TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) { EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(3)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(0)->As(), 4._h); - EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(1)->As(), 4._h); - EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(2)->As(), 4._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(0)->ValueAs(), 4._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(1)->ValueAs(), 4._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(2)->ValueAs(), 4._h); EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero()); @@ -2011,8 +2011,8 @@ TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) { EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is()); EXPECT_TRUE( sem->ConstantValue()->Index(4)->Type()->As()->type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(0)->As(), false); - EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(1)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(0)->ValueAs(), false); + EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(1)->ValueAs(), false); } TEST_F(ResolverConstEvalTest, Struct_Struct_Construct) { @@ -2048,17 +2048,17 @@ TEST_F(ResolverConstEvalTest, Struct_Struct_Construct) { EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1_i); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2_u); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 3_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 1_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 2_u); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->ValueAs(), 3_f); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 4_i); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0_u); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 6_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 4_i); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs(), 6_f); } TEST_F(ResolverConstEvalTest, Struct_Array_Construct) { @@ -2088,16 +2088,16 @@ TEST_F(ResolverConstEvalTest, Struct_Array_Construct) { EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1_i); - EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs(), 1_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs(), 2_i); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 1_f); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 2_f); - EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 3_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs(), 1_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs(), 2_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs(), 3_f); } } // namespace diff --git a/src/tint/resolver/const_eval_conversion_test.cc b/src/tint/resolver/const_eval_conversion_test.cc index 435c4e69be..d4b562f293 100644 --- a/src/tint/resolver/const_eval_conversion_test.cc +++ b/src/tint/resolver/const_eval_conversion_test.cc @@ -242,17 +242,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_f32_to_i32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3); } TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f32) { @@ -275,17 +275,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10.f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 10.f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 20.f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 20.f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 30.f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 30.f); } TEST_F(ResolverConstEvalTest, Vec3_Convert_f16_to_i32) { @@ -310,17 +310,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_f16_to_i32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 1_i); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2_i); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 2_i); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3_i); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 3_i); } TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f16) { @@ -345,17 +345,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f16) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10.f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 10.f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 20.f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 20.f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 30.f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 30.f); } TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_i32) { @@ -378,17 +378,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_i32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), i32::Highest()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), i32::Highest()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), i32::Lowest()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), i32::Lowest()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), i32::Highest()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), i32::Highest()); } TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_u32) { @@ -411,17 +411,17 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_u32) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), u32::Highest()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), u32::Highest()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), u32::Lowest()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), u32::Lowest()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), u32::Highest()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), u32::Highest()); } TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_f16) { @@ -456,20 +456,20 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_Small_f32_to_f16) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0.0); - EXPECT_FALSE(std::signbit(sem->ConstantValue()->Index(0)->As().value)); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 0.0); + EXPECT_FALSE(std::signbit(sem->ConstantValue()->Index(0)->ValueAs().value)); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -0.0); - EXPECT_TRUE(std::signbit(sem->ConstantValue()->Index(1)->As().value)); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), -0.0); + EXPECT_TRUE(std::signbit(sem->ConstantValue()->Index(1)->ValueAs().value)); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0.0); - EXPECT_FALSE(std::signbit(sem->ConstantValue()->Index(2)->As().value)); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 0.0); + EXPECT_FALSE(std::signbit(sem->ConstantValue()->Index(2)->ValueAs().value)); } } // namespace diff --git a/src/tint/resolver/const_eval_indexing_test.cc b/src/tint/resolver/const_eval_indexing_test.cc index c894d8ff6e..7f9ae6fb2d 100644 --- a/src/tint/resolver/const_eval_indexing_test.cc +++ b/src/tint/resolver/const_eval_indexing_test.cc @@ -32,7 +32,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Index) { EXPECT_TRUE(sem->ConstantValue()->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->AllZero()); - EXPECT_EQ(sem->ConstantValue()->As(), 3_i); + EXPECT_EQ(sem->ConstantValue()->ValueAs(), 3_i); } TEST_F(ResolverConstEvalTest, Vec3_Index_OOB_High) { @@ -64,7 +64,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Swizzle_Scalar) { EXPECT_TRUE(sem->ConstantValue()->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->AllZero()); - EXPECT_EQ(sem->ConstantValue()->As(), 2_i); + EXPECT_EQ(sem->ConstantValue()->ValueAs(), 2_i); } TEST_F(ResolverConstEvalTest, Vec3_Swizzle_Vector) { @@ -83,12 +83,12 @@ TEST_F(ResolverConstEvalTest, Vec3_Swizzle_Vector) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 3._a); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 3._a); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 1._a); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 1._a); } TEST_F(ResolverConstEvalTest, Vec3_Swizzle_Chain) { @@ -105,7 +105,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Swizzle_Chain) { EXPECT_TRUE(sem->ConstantValue()->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->AllZero()); - EXPECT_EQ(sem->ConstantValue()->As(), 2_i); + EXPECT_EQ(sem->ConstantValue()->ValueAs(), 2_i); } TEST_F(ResolverConstEvalTest, Mat3x2_Index) { @@ -125,12 +125,12 @@ TEST_F(ResolverConstEvalTest, Mat3x2_Index) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 5._a); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 5._a); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 6._a); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 6._a); } TEST_F(ResolverConstEvalTest, Mat3x2_Index_OOB_High) { @@ -172,17 +172,17 @@ TEST_F(ResolverConstEvalTest, Array_vec3_f32_Index) { EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 4_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs(), 4_f); EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 5_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs(), 5_f); EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 6_f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs(), 6_f); } TEST_F(ResolverConstEvalTest, Array_vec3_f32_Index_OOB_High) { @@ -245,32 +245,32 @@ TEST_F(ResolverConstEvalTest, ChainedIndex) { EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(0)->AllEqual()); EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(0)->AnyZero()); EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(0)->AllZero()); - EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(0)->As(), 7_f); + EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(0)->ValueAs(), 7_f); EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(1)->AllEqual()); EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(1)->AnyZero()); EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(1)->AllZero()); - EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(1)->As(), 0_f); + EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(1)->ValueAs(), 0_f); EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(2)->AllEqual()); EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(2)->AnyZero()); EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(2)->AllZero()); - EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(2)->As(), 9_f); + EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(2)->ValueAs(), 9_f); EXPECT_TRUE(mat->ConstantValue()->Index(1)->Index(0)->AllEqual()); EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(0)->AnyZero()); EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(0)->AllZero()); - EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(0)->As(), 10_f); + EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(0)->ValueAs(), 10_f); EXPECT_TRUE(mat->ConstantValue()->Index(1)->Index(1)->AllEqual()); EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(1)->AnyZero()); EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(1)->AllZero()); - EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(1)->As(), 11_f); + EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(1)->ValueAs(), 11_f); EXPECT_TRUE(mat->ConstantValue()->Index(1)->Index(2)->AllEqual()); EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(2)->AnyZero()); EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(2)->AllZero()); - EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(2)->As(), 12_f); + EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(2)->ValueAs(), 12_f); } { auto* vec = Sem().Get(vec_expr); @@ -287,17 +287,17 @@ TEST_F(ResolverConstEvalTest, ChainedIndex) { EXPECT_TRUE(vec->ConstantValue()->Index(0)->AllEqual()); EXPECT_FALSE(vec->ConstantValue()->Index(0)->AnyZero()); EXPECT_FALSE(vec->ConstantValue()->Index(0)->AllZero()); - EXPECT_EQ(vec->ConstantValue()->Index(0)->As(), 7_f); + EXPECT_EQ(vec->ConstantValue()->Index(0)->ValueAs(), 7_f); EXPECT_TRUE(vec->ConstantValue()->Index(1)->AllEqual()); EXPECT_TRUE(vec->ConstantValue()->Index(1)->AnyZero()); EXPECT_TRUE(vec->ConstantValue()->Index(1)->AllZero()); - EXPECT_EQ(vec->ConstantValue()->Index(1)->As(), 0_f); + EXPECT_EQ(vec->ConstantValue()->Index(1)->ValueAs(), 0_f); EXPECT_TRUE(vec->ConstantValue()->Index(2)->AllEqual()); EXPECT_FALSE(vec->ConstantValue()->Index(2)->AnyZero()); EXPECT_FALSE(vec->ConstantValue()->Index(2)->AllZero()); - EXPECT_EQ(vec->ConstantValue()->Index(2)->As(), 9_f); + EXPECT_EQ(vec->ConstantValue()->Index(2)->ValueAs(), 9_f); } { auto* f = Sem().Get(f32_expr); @@ -307,7 +307,7 @@ TEST_F(ResolverConstEvalTest, ChainedIndex) { EXPECT_TRUE(f->ConstantValue()->AllEqual()); EXPECT_FALSE(f->ConstantValue()->AnyZero()); EXPECT_FALSE(f->ConstantValue()->AllZero()); - EXPECT_EQ(f->ConstantValue()->As(), 9_f); + EXPECT_EQ(f->ConstantValue()->ValueAs(), 9_f); } } } // namespace diff --git a/src/tint/resolver/const_eval_member_access_test.cc b/src/tint/resolver/const_eval_member_access_test.cc index 1dcd3a7967..a1e7e59860 100644 --- a/src/tint/resolver/const_eval_member_access_test.cc +++ b/src/tint/resolver/const_eval_member_access_test.cc @@ -56,9 +56,9 @@ TEST_F(ResolverConstEvalTest, MemberAccess) { EXPECT_FALSE(o1->ConstantValue()->AnyZero()); EXPECT_FALSE(o1->ConstantValue()->AllZero()); EXPECT_TRUE(o1->ConstantValue()->Type()->Is()); - EXPECT_EQ(o1->ConstantValue()->Index(0)->As(), 1_i); - EXPECT_EQ(o1->ConstantValue()->Index(1)->As(), 2_u); - EXPECT_EQ(o1->ConstantValue()->Index(2)->As(), 3_f); + EXPECT_EQ(o1->ConstantValue()->Index(0)->ValueAs(), 1_i); + EXPECT_EQ(o1->ConstantValue()->Index(1)->ValueAs(), 2_u); + EXPECT_EQ(o1->ConstantValue()->Index(2)->ValueAs(), 3_f); auto* i2 = Sem().Get(i2_expr); ASSERT_NE(i2->ConstantValue(), nullptr); @@ -66,7 +66,7 @@ TEST_F(ResolverConstEvalTest, MemberAccess) { EXPECT_FALSE(i2->ConstantValue()->AnyZero()); EXPECT_FALSE(i2->ConstantValue()->AllZero()); EXPECT_TRUE(i2->ConstantValue()->Type()->Is()); - EXPECT_EQ(i2->ConstantValue()->As(), 2_u); + EXPECT_EQ(i2->ConstantValue()->ValueAs(), 2_u); } TEST_F(ResolverConstEvalTest, Matrix_AFloat_Construct_From_AInt_Vectors) { diff --git a/src/tint/resolver/const_eval_test.h b/src/tint/resolver/const_eval_test.h index 0429e8f8d3..1420be8f10 100644 --- a/src/tint/resolver/const_eval_test.h +++ b/src/tint/resolver/const_eval_test.h @@ -42,13 +42,13 @@ inline void CollectScalars(const constant::Constant* c, utils::Vector& scalars) { Switch( c->Type(), // - [&](const type::AbstractInt*) { scalars.Push(c->As()); }, - [&](const type::AbstractFloat*) { scalars.Push(c->As()); }, - [&](const type::Bool*) { scalars.Push(c->As()); }, - [&](const type::I32*) { scalars.Push(c->As()); }, - [&](const type::U32*) { scalars.Push(c->As()); }, - [&](const type::F32*) { scalars.Push(c->As()); }, - [&](const type::F16*) { scalars.Push(c->As()); }, + [&](const type::AbstractInt*) { scalars.Push(c->ValueAs()); }, + [&](const type::AbstractFloat*) { scalars.Push(c->ValueAs()); }, + [&](const type::Bool*) { scalars.Push(c->ValueAs()); }, + [&](const type::I32*) { scalars.Push(c->ValueAs()); }, + [&](const type::U32*) { scalars.Push(c->ValueAs()); }, + [&](const type::F32*) { scalars.Push(c->ValueAs()); }, + [&](const type::F16*) { scalars.Push(c->ValueAs()); }, [&](Default) { size_t i = 0; while (auto* child = c->Index(i++)) { diff --git a/src/tint/resolver/const_eval_unary_op_test.cc b/src/tint/resolver/const_eval_unary_op_test.cc index cb342d1fd4..df67e54723 100644 --- a/src/tint/resolver/const_eval_unary_op_test.cc +++ b/src/tint/resolver/const_eval_unary_op_test.cc @@ -159,7 +159,7 @@ TEST_F(ResolverConstEvalTest, UnaryNegateLowestAbstract) { (void)c; EXPECT_TRUE(r()->Resolve()) << r()->error(); auto* sem = Sem().Get(c); - EXPECT_EQ(sem->ConstantValue()->As(), 9223372036854775808_a); + EXPECT_EQ(sem->ConstantValue()->ValueAs(), 9223372036854775808_a); } INSTANTIATE_TEST_SUITE_P(Not, diff --git a/src/tint/resolver/resolver.cc b/src/tint/resolver/resolver.cc index 7811e15238..6bc8383bdb 100644 --- a/src/tint/resolver/resolver.cc +++ b/src/tint/resolver/resolver.cc @@ -480,7 +480,7 @@ sem::Variable* Resolver::Override(const ast::Override* v) { } auto const_value = materialized->ConstantValue(); - auto value = const_value->As(); + auto value = const_value->ValueAs(); if (value < 0) { AddError("@id value must be non-negative", id_attr->source); return nullptr; @@ -660,7 +660,7 @@ sem::Variable* Resolver::Var(const ast::Var* var, bool is_global) { } auto const_value = materialized->ConstantValue(); - auto value = const_value->As(); + auto value = const_value->ValueAs(); if (value < 0) { AddError("@binding value must be non-negative", attr->source); return nullptr; @@ -684,7 +684,7 @@ sem::Variable* Resolver::Var(const ast::Var* var, bool is_global) { } auto const_value = materialized->ConstantValue(); - auto value = const_value->As(); + auto value = const_value->ValueAs(); if (value < 0) { AddError("@group value must be non-negative", attr->source); return nullptr; @@ -762,7 +762,7 @@ sem::Parameter* Resolver::Parameter(const ast::Parameter* param, uint32_t index) if (!materialized) { return nullptr; } - binding_point.binding = materialized->ConstantValue()->As(); + binding_point.binding = materialized->ConstantValue()->ValueAs(); } { ExprEvalStageConstraint constraint{sem::EvaluationStage::kConstant, "@group value"}; @@ -773,7 +773,7 @@ sem::Parameter* Resolver::Parameter(const ast::Parameter* param, uint32_t index) if (!materialized) { return nullptr; } - binding_point.group = materialized->ConstantValue()->As(); + binding_point.group = materialized->ConstantValue()->ValueAs(); } } @@ -808,7 +808,7 @@ utils::Result Resolver::LocationAttribute(const ast::LocationAttribute } auto const_value = materialized->ConstantValue(); - auto value = const_value->As(); + auto value = const_value->ValueAs(); if (value < 0) { AddError("@location value must be non-negative", attr->source); return utils::Failure; @@ -946,7 +946,7 @@ sem::Statement* Resolver::StaticAssert(const ast::StaticAssert* assertion) { assertion->condition->source); return nullptr; } - if (!cond->As()) { + if (!cond->ValueAs()) { AddError("static assertion failed", assertion->source); return nullptr; } @@ -1181,11 +1181,11 @@ bool Resolver::WorkgroupSize(const ast::Function* func) { return false; } if (auto* value = materialized->ConstantValue()) { - if (value->As() < 1) { + if (value->ValueAs() < 1) { AddError("workgroup_size argument must be at least 1", values[i]->source); return false; } - ws[i] = value->As(); + ws[i] = value->ValueAs(); } else { ws[i] = std::nullopt; } @@ -1571,7 +1571,7 @@ sem::Expression* Resolver::Expression(const ast::Expression* root) { // short-circuiting. if (sem_expr->ConstantValue()) { if (auto binary = logical_binary_lhs_to_parent_.Find(expr)) { - const bool lhs_is_true = sem_expr->ConstantValue()->As(); + const bool lhs_is_true = sem_expr->ConstantValue()->ValueAs(); if (((*binary)->IsLogicalAnd() && !lhs_is_true) || ((*binary)->IsLogicalOr() && lhs_is_true)) { // Mark entire expression tree to not const-evaluate @@ -3110,7 +3110,7 @@ const type::ArrayCount* Resolver::ArrayCount(const ast::Expression* count_expr) return nullptr; } - int64_t count = count_val->As(); + int64_t count = count_val->ValueAs(); if (count < 1) { AddError("array count (" + std::to_string(count) + ") must be greater than 0", count_expr->source); @@ -3270,7 +3270,7 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) { AddError("@offset must be constant expression", o->expr->source); return false; } - offset = const_value->As(); + offset = const_value->ValueAs(); if (offset < struct_size) { AddError("offsets must be in ascending order", o->source); @@ -3297,7 +3297,7 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) { AddError("@align must be constant expression", a->source); return false; } - auto value = const_value->As(); + auto value = const_value->ValueAs(); if (value <= 0 || !utils::IsPowerOfTwo(value)) { AddError("@align value must be a positive, power-of-two integer", @@ -3327,13 +3327,13 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) { return false; } { - auto value = const_value->As(); + auto value = const_value->ValueAs(); if (value <= 0) { AddError("@size must be a positive integer", s->source); return false; } } - auto value = const_value->As(); + auto value = const_value->ValueAs(); if (value < size) { AddError("@size must be at least as big as the type's size (" + std::to_string(size) + ")", diff --git a/src/tint/resolver/validator.cc b/src/tint/resolver/validator.cc index 24b2e7b529..479cb9c1b6 100644 --- a/src/tint/resolver/validator.cc +++ b/src/tint/resolver/validator.cc @@ -1573,7 +1573,7 @@ bool Validator::TextureBuiltinFunction(const sem::Call* call) const { if (auto values = arg->ConstantValue()) { if (auto* vector = values->Type()->As()) { for (size_t i = 0; i < vector->Width(); i++) { - auto value = values->Index(i)->As(); + auto value = values->Index(i)->ValueAs(); if (value < min || value > max) { AddError("each component of the " + name + " argument must be at least " + std::to_string(min) + " and at most " + std::to_string(max) + @@ -1584,7 +1584,7 @@ bool Validator::TextureBuiltinFunction(const sem::Call* call) const { } } } else { - auto value = values->As(); + auto value = values->ValueAs(); if (value < min || value > max) { AddError("the " + name + " argument must be at least " + std::to_string(min) + " and at most " + std::to_string(max) + ". " + name + " is " + @@ -2239,7 +2239,7 @@ bool Validator::SwitchStatement(const ast::SwitchStatement* s) { return false; } - auto value = selector->Value()->As(); + auto value = selector->Value()->ValueAs(); if (auto added = selectors.Add(value, selector->Declaration()->source); !added) { AddError("duplicate switch case '" + (decl_ty->IsAnyOf() diff --git a/src/tint/resolver/variable_test.cc b/src/tint/resolver/variable_test.cc index ad3420e5fd..196151679e 100644 --- a/src/tint/resolver/variable_test.cc +++ b/src/tint/resolver/variable_test.cc @@ -1011,7 +1011,7 @@ TEST_F(ResolverVariableTest, LocalConst_PropagateConstValue) { ASSERT_TRUE(TypeOf(c)->Is()); - EXPECT_EQ(Sem().Get(c)->ConstantValue()->As(), 42_i); + EXPECT_EQ(Sem().Get(c)->ConstantValue()->ValueAs(), 42_i); } TEST_F(ResolverVariableTest, LocalConst_ConstEval) { @@ -1023,7 +1023,7 @@ TEST_F(ResolverVariableTest, LocalConst_ConstEval) { ASSERT_TRUE(TypeOf(c)->Is()); - EXPECT_EQ(Sem().Get(c)->ConstantValue()->As(), 3_i); + EXPECT_EQ(Sem().Get(c)->ConstantValue()->ValueAs(), 3_i); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1178,7 +1178,7 @@ TEST_F(ResolverVariableTest, GlobalConst_PropagateConstValue) { ASSERT_TRUE(TypeOf(c)->Is()); - EXPECT_EQ(Sem().Get(c)->ConstantValue()->As(), 42_i); + EXPECT_EQ(Sem().Get(c)->ConstantValue()->ValueAs(), 42_i); } TEST_F(ResolverVariableTest, GlobalConst_ConstEval) { @@ -1188,7 +1188,7 @@ TEST_F(ResolverVariableTest, GlobalConst_ConstEval) { ASSERT_TRUE(TypeOf(c)->Is()); - EXPECT_EQ(Sem().Get(c)->ConstantValue()->As(), 3_i); + EXPECT_EQ(Sem().Get(c)->ConstantValue()->ValueAs(), 3_i); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/tint/transform/direct_variable_access.cc b/src/tint/transform/direct_variable_access.cc index 5f1ffc1d99..1dbb51ee36 100644 --- a/src/tint/transform/direct_variable_access.cc +++ b/src/tint/transform/direct_variable_access.cc @@ -559,7 +559,7 @@ struct DirectVariableAccess::State { const ast::Expression* BuildDynamicIndex(const sem::Expression* idx, bool cast_to_u32) { if (auto* val = idx->ConstantValue()) { // Expression evaluated to a constant value. Just emit that constant. - return b.Expr(val->As()); + return b.Expr(val->ValueAs()); } // Expression is not a constant, clone the expression. diff --git a/src/tint/transform/std140.cc b/src/tint/transform/std140.cc index d0bc205e81..3f9401865d 100644 --- a/src/tint/transform/std140.cc +++ b/src/tint/transform/std140.cc @@ -545,7 +545,7 @@ struct Std140::State { [&](const sem::IndexAccessorExpression* a) { // Array, matrix or vector index. if (auto* val = a->Index()->ConstantValue()) { - access.indices.Push(val->As()); + access.indices.Push(val->ValueAs()); } else { access.indices.Push(DynamicIndex{access.dynamic_indices.Length()}); access.dynamic_indices.Push(a->Index()); diff --git a/src/tint/transform/zero_init_workgroup_memory.cc b/src/tint/transform/zero_init_workgroup_memory.cc index a6fe234f31..c33834a411 100644 --- a/src/tint/transform/zero_init_workgroup_memory.cc +++ b/src/tint/transform/zero_init_workgroup_memory.cc @@ -405,7 +405,7 @@ struct ZeroInitWorkgroupMemory::State { } auto* sem = ctx.src->Sem().Get(expr); if (auto* c = sem->ConstantValue()) { - workgroup_size_const *= c->As(); + workgroup_size_const *= c->ValueAs(); continue; } // Constant value could not be found. Build expression instead. diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc index 6f97cc6c32..221d9bc364 100644 --- a/src/tint/writer/glsl/generator_impl.cc +++ b/src/tint/writer/glsl/generator_impl.cc @@ -2298,23 +2298,23 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const constant::Constant* co return Switch( constant->Type(), // [&](const type::Bool*) { - out << (constant->As() ? "true" : "false"); + out << (constant->ValueAs() ? "true" : "false"); return true; }, [&](const type::F32*) { - PrintF32(out, constant->As()); + PrintF32(out, constant->ValueAs()); return true; }, [&](const type::F16*) { - PrintF16(out, constant->As()); + PrintF16(out, constant->ValueAs()); return true; }, [&](const type::I32*) { - out << constant->As(); + out << constant->ValueAs(); return true; }, [&](const type::U32*) { - out << constant->As() << "u"; + out << constant->ValueAs() << "u"; return true; }, [&](const type::Vector* v) { diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc index d62c668e65..d21865b168 100644 --- a/src/tint/writer/hlsl/generator_impl.cc +++ b/src/tint/writer/hlsl/generator_impl.cc @@ -2495,7 +2495,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, case sem::BuiltinType::kTextureGather: out << ".Gather"; if (builtin->Parameters()[0]->Usage() == sem::ParameterUsage::kComponent) { - switch (call->Arguments()[0]->ConstantValue()->As()) { + switch (call->Arguments()[0]->ConstantValue()->ValueAs()) { case 0: out << "Red"; break; @@ -3268,26 +3268,26 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, return Switch( constant->Type(), // [&](const type::Bool*) { - out << (constant->As() ? "true" : "false"); + out << (constant->ValueAs() ? "true" : "false"); return true; }, [&](const type::F32*) { - PrintF32(out, constant->As()); + PrintF32(out, constant->ValueAs()); return true; }, [&](const type::F16*) { // emit a f16 scalar with explicit float16_t type declaration. out << "float16_t("; - PrintF16(out, constant->As()); + PrintF16(out, constant->ValueAs()); out << ")"; return true; }, [&](const type::I32*) { - out << constant->As(); + out << constant->ValueAs(); return true; }, [&](const type::U32*) { - out << constant->As() << "u"; + out << constant->ValueAs() << "u"; return true; }, [&](const type::Vector* v) { diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc index 6b47d8c2c3..15e190b937 100644 --- a/src/tint/writer/msl/generator_impl.cc +++ b/src/tint/writer/msl/generator_impl.cc @@ -1264,7 +1264,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, break; // Other texture dimensions don't have an offset } } - auto c = component->ConstantValue()->As(); + auto c = component->ConstantValue()->ValueAs(); switch (c.value) { case 0: out << "component::x"; @@ -1662,23 +1662,23 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const constant::Constant* co return Switch( constant->Type(), // [&](const type::Bool*) { - out << (constant->As() ? "true" : "false"); + out << (constant->ValueAs() ? "true" : "false"); return true; }, [&](const type::F32*) { - PrintF32(out, constant->As()); + PrintF32(out, constant->ValueAs()); return true; }, [&](const type::F16*) { - PrintF16(out, constant->As()); + PrintF16(out, constant->ValueAs()); return true; }, [&](const type::I32*) { - PrintI32(out, constant->As()); + PrintI32(out, constant->ValueAs()); return true; }, [&](const type::U32*) { - out << constant->As() << "u"; + out << constant->ValueAs() << "u"; return true; }, [&](const type::Vector* v) { diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc index cc04df16e0..79b0c92f31 100644 --- a/src/tint/writer/spirv/builder.cc +++ b/src/tint/writer/spirv/builder.cc @@ -905,7 +905,7 @@ bool Builder::GenerateIndexAccessor(const ast::IndexAccessorExpression* expr, Ac Operand(result_type_id), extract, Operand(info->source_id), - Operand(idx_constval->As()), + Operand(idx_constval->ValueAs()), })) { return false; } @@ -1681,23 +1681,23 @@ uint32_t Builder::GenerateConstantIfNeeded(const constant::Constant* constant) { return Switch( ty, // [&](const type::Bool*) { - bool val = constant->As(); + bool val = constant->ValueAs(); return GenerateConstantIfNeeded(ScalarConstant::Bool(val)); }, [&](const type::F32*) { - auto val = constant->As(); + auto val = constant->ValueAs(); return GenerateConstantIfNeeded(ScalarConstant::F32(val.value)); }, [&](const type::F16*) { - auto val = constant->As(); + auto val = constant->ValueAs(); return GenerateConstantIfNeeded(ScalarConstant::F16(val.value)); }, [&](const type::I32*) { - auto val = constant->As(); + auto val = constant->ValueAs(); return GenerateConstantIfNeeded(ScalarConstant::I32(val.value)); }, [&](const type::U32*) { - auto val = constant->As(); + auto val = constant->ValueAs(); return GenerateConstantIfNeeded(ScalarConstant::U32(val.value)); }, [&](const type::Vector* v) { return composite(v->Width()); }, @@ -3451,7 +3451,7 @@ bool Builder::GenerateSwitchStatement(const ast::SwitchStatement* stmt) { continue; } - params.push_back(Operand(selector->Value()->As())); + params.push_back(Operand(selector->Value()->ValueAs())); params.push_back(Operand(block_id)); } }