diff options
Diffstat (limited to 'test/gtest')
-rw-r--r-- | test/gtest/possible-contents.cpp | 10 | ||||
-rw-r--r-- | test/gtest/type-builder.cpp | 13 |
2 files changed, 15 insertions, 8 deletions
diff --git a/test/gtest/possible-contents.cpp b/test/gtest/possible-contents.cpp index 2994a6221..2bed9a882 100644 --- a/test/gtest/possible-contents.cpp +++ b/test/gtest/possible-contents.cpp @@ -59,6 +59,9 @@ protected: wasm::setTypeSystem(TypeSystem::Nominal); } + Type anyref = Type(HeapType::any, Nullable); + Type funcref = Type(HeapType::func, Nullable); + PossibleContents none = PossibleContents::none(); PossibleContents i32Zero = PossibleContents::literal(Literal(int32_t(0))); @@ -74,15 +77,14 @@ protected: PossibleContents i32Global2 = PossibleContents::global("i32Global2", Type::i32); PossibleContents f64Global = PossibleContents::global("f64Global", Type::f64); - PossibleContents anyGlobal = - PossibleContents::global("anyGlobal", Type::anyref); + PossibleContents anyGlobal = PossibleContents::global("anyGlobal", anyref); PossibleContents nonNullFunc = PossibleContents::literal( Literal("func", Type(Signature(Type::none, Type::none), NonNullable))); PossibleContents exactI32 = PossibleContents::exactType(Type::i32); - PossibleContents exactAnyref = PossibleContents::exactType(Type::anyref); - PossibleContents exactFuncref = PossibleContents::exactType(Type::funcref); + PossibleContents exactAnyref = PossibleContents::exactType(anyref); + PossibleContents exactFuncref = PossibleContents::exactType(funcref); PossibleContents exactNonNullAnyref = PossibleContents::exactType(Type(HeapType::any, NonNullable)); PossibleContents exactNonNullFuncref = diff --git a/test/gtest/type-builder.cpp b/test/gtest/type-builder.cpp index ca9bd865d..d06236130 100644 --- a/test/gtest/type-builder.cpp +++ b/test/gtest/type-builder.cpp @@ -481,11 +481,13 @@ static void testCanonicalizeBasicTypes() { Type anyref = builder.getTempRefType(builder[0], Nullable); Type anyrefs = builder.getTempTupleType({anyref, anyref}); + Type anyrefCanon = Type(HeapType::any, Nullable); + builder[0] = HeapType::any; builder[1] = Struct({Field(anyref, Immutable)}); - builder[2] = Struct({Field(Type::anyref, Immutable)}); + builder[2] = Struct({Field(anyrefCanon, Immutable)}); builder[3] = Signature(anyrefs, Type::none); - builder[4] = Signature({Type::anyref, Type::anyref}, Type::none); + builder[4] = Signature({anyrefCanon, anyrefCanon}, Type::none); auto result = builder.build(); ASSERT_TRUE(result); @@ -504,10 +506,13 @@ TEST_F(IsorecursiveTest, CanonicalizeBasicTypes) { // Test SubTypes utility code. TEST_F(NominalTest, testSubTypes) { + Type anyref = Type(HeapType::any, Nullable); + Type funcref = Type(HeapType::func, Nullable); + // Build type types, the second of which is a subtype. TypeBuilder builder(2); - builder[0] = Struct({Field(Type::anyref, Immutable)}); - builder[1] = Struct({Field(Type::funcref, Immutable)}); + builder[0] = Struct({Field(anyref, Immutable)}); + builder[1] = Struct({Field(funcref, Immutable)}); builder[1].subTypeOf(builder[0]); auto built = *builder.build(); |