diff options
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/type-builder-nominal.cpp | 9 | ||||
-rw-r--r-- | test/example/type-builder-nominal.txt | 20 | ||||
-rw-r--r-- | test/example/type-builder.cpp | 34 | ||||
-rw-r--r-- | test/example/typeinfo.cpp | 47 | ||||
-rw-r--r-- | test/example/typeinfo.txt | 16 |
5 files changed, 6 insertions, 120 deletions
diff --git a/test/example/type-builder-nominal.cpp b/test/example/type-builder-nominal.cpp index cbda43f1f..13224f55e 100644 --- a/test/example/type-builder-nominal.cpp +++ b/test/example/type-builder-nominal.cpp @@ -12,7 +12,7 @@ void test_builder() { std::cout << ";; Test TypeBuilder\n"; // (type $sig (func (param (ref $struct)) (result (ref $array) i32))) - // (type $struct (struct (field (ref null $array) (mut rtt 0 $array)))) + // (type $struct (struct (field (ref null $array)))) // (type $array (array (mut anyref))) TypeBuilder builder; @@ -24,11 +24,10 @@ void test_builder() { Type refStruct = builder.getTempRefType(builder[1], NonNullable); Type refArray = builder.getTempRefType(builder[2], NonNullable); Type refNullArray = builder.getTempRefType(builder[2], Nullable); - Type rttArray = builder.getTempRttType(Rtt(0, builder[2])); Type refNullAny(HeapType::any, Nullable); Signature sig(refStruct, builder.getTempTupleType({refArray, Type::i32})); - Struct struct_({Field(refNullArray, Immutable), Field(rttArray, Mutable)}); + Struct struct_({Field(refNullArray, Immutable)}); Array array(Field(refNullAny, Mutable)); { @@ -41,7 +40,6 @@ void test_builder() { std::cout << "(ref $struct) => " << print(refStruct) << "\n"; std::cout << "(ref $array) => " << print(refArray) << "\n"; std::cout << "(ref null $array) => " << print(refNullArray) << "\n"; - std::cout << "(rtt 0 $array) => " << print(rttArray) << "\n\n"; } builder[0] = sig; @@ -58,7 +56,6 @@ void test_builder() { std::cout << "(ref $struct) => " << print(refStruct) << "\n"; std::cout << "(ref $array) => " << print(refArray) << "\n"; std::cout << "(ref null $array) => " << print(refNullArray) << "\n"; - std::cout << "(rtt 0 $array) => " << print(rttArray) << "\n\n"; } std::vector<HeapType> built = *builder.build(); @@ -67,7 +64,6 @@ void test_builder() { Type newRefStruct = Type(built[1], NonNullable); Type newRefArray = Type(built[2], NonNullable); Type newRefNullArray = Type(built[2], Nullable); - Type newRttArray = Type(Rtt(0, built[2])); { IndexedTypeNameGenerator print(built); @@ -79,7 +75,6 @@ void test_builder() { std::cout << "(ref $struct) => " << print(newRefStruct) << "\n"; std::cout << "(ref $array) => " << print(newRefArray) << "\n"; std::cout << "(ref null $array) => " << print(newRefNullArray) << "\n"; - std::cout << "(rtt 0 $array) => " << print(newRttArray) << "\n\n"; } } diff --git a/test/example/type-builder-nominal.txt b/test/example/type-builder-nominal.txt index 745f63df2..8d146cc1f 100644 --- a/test/example/type-builder-nominal.txt +++ b/test/example/type-builder-nominal.txt @@ -7,28 +7,22 @@ $array => (; temp ;) (func_subtype func) (ref $struct) => (; temp ;) (ref $1) (ref $array) => (; temp ;) (ref $2) (ref null $array) => (; temp ;) (ref null $2) -(rtt 0 $array) => (; temp ;) (rtt 0 $2) - After setting heap types: $sig => (; temp ;) (func_subtype (param (; temp ;) (ref $1)) (result (; temp ;) (ref $2) i32) func) -$struct => (; temp ;) (struct_subtype (field (; temp ;) (ref null $2) (mut (; temp ;) (rtt 0 $2))) data) +$struct => (; temp ;) (struct_subtype (field (; temp ;) (ref null $2)) data) $array => (; temp ;) (array_subtype (mut anyref) data) (ref $sig) => (; temp ;) (ref $0) (ref $struct) => (; temp ;) (ref $1) (ref $array) => (; temp ;) (ref $2) (ref null $array) => (; temp ;) (ref null $2) -(rtt 0 $array) => (; temp ;) (rtt 0 $2) - After building types: $sig => (func_subtype (param (ref $1)) (result (ref $2) i32) func) -$struct => (struct_subtype (field (ref null $2) (mut (rtt 0 $2))) data) +$struct => (struct_subtype (field (ref null $2)) data) $array => (array_subtype (mut anyref) data) (ref $sig) => (ref $0) (ref $struct) => (ref $1) (ref $array) => (ref $2) (ref null $array) => (ref null $2) -(rtt 0 $array) => (rtt 0 $2) - ;; Test canonicalization ;; Test basic ;; Test canonical signatures @@ -64,28 +58,22 @@ $array => (; temp ;) (func_subtype func) (ref $struct) => (; temp ;) (ref $1) (ref $array) => (; temp ;) (ref $2) (ref null $array) => (; temp ;) (ref null $2) -(rtt 0 $array) => (; temp ;) (rtt 0 $2) - After setting heap types: $sig => (; temp ;) (func_subtype (param (; temp ;) (ref $1)) (result (; temp ;) (ref $2) i32) func) -$struct => (; temp ;) (struct_subtype (field (; temp ;) (ref null $2) (mut (; temp ;) (rtt 0 $2))) data) +$struct => (; temp ;) (struct_subtype (field (; temp ;) (ref null $2)) data) $array => (; temp ;) (array_subtype (mut anyref) data) (ref $sig) => (; temp ;) (ref $0) (ref $struct) => (; temp ;) (ref $1) (ref $array) => (; temp ;) (ref $2) (ref null $array) => (; temp ;) (ref null $2) -(rtt 0 $array) => (; temp ;) (rtt 0 $2) - After building types: $sig => (func_subtype (param (ref $1)) (result (ref $2) i32) func) -$struct => (struct_subtype (field (ref null $2) (mut (rtt 0 $2))) data) +$struct => (struct_subtype (field (ref null $2)) data) $array => (array_subtype (mut anyref) data) (ref $sig) => (ref $0) (ref $struct) => (ref $1) (ref $array) => (ref $2) (ref null $array) => (ref null $2) -(rtt 0 $array) => (rtt 0 $2) - ;; Test canonicalization ;; Test basic ;; Test canonical signatures diff --git a/test/example/type-builder.cpp b/test/example/type-builder.cpp index 219282ea8..41c556878 100644 --- a/test/example/type-builder.cpp +++ b/test/example/type-builder.cpp @@ -396,40 +396,6 @@ void test_lub() { assert(LUB(a, b) == lub); } - - { - // Incompatible Rtts - Type a{Rtt(HeapType::eq)}; - Type b{Rtt(HeapType::func)}; - assert(LUB(a, b) == Type::none); - } - - { - // Rtts with matching depth - Type a(Rtt(42, HeapType::any)); - assert(LUB(a, a) == a); - } - - { - // Rtts with mismatched depth - Type a(Rtt(42, HeapType::any)); - Type b(Rtt(50, HeapType::any)); - Type lub{Rtt(HeapType::any)}; - assert(LUB(a, b) == lub); - } - - { - // Rtts with and without depth - Type a(Rtt(42, HeapType::any)); - Type b{Rtt(HeapType::any)}; - assert(LUB(a, b) == b); - } - - { - // Rtts without depth - Type a{Rtt(HeapType::any)}; - assert(LUB(a, a) == a); - } } int main() { diff --git a/test/example/typeinfo.cpp b/test/example/typeinfo.cpp index 55e7b9082..ff20753b1 100644 --- a/test/example/typeinfo.cpp +++ b/test/example/typeinfo.cpp @@ -91,33 +91,6 @@ void test_compound() { Tuple otherTuple({Type::f64, Type::i64}); assert(Type(tuple).getID() != Type(otherTuple).getID()); } - { - Rtt rtt(0, HeapType::func); - assert(Type(rtt).getID() == Type(rtt).getID()); - - Rtt sameRtt(0, HeapType::func); - assert(rtt == sameRtt); - assert(Type(rtt).getID() == Type(sameRtt).getID()); - - Rtt otherDepthRtt(1, HeapType::func); - assert(rtt != otherDepthRtt); - assert(Type(rtt).getID() != Type(otherDepthRtt).getID()); - - Rtt otherHeapTypeRtt(0, HeapType::any); - assert(rtt != otherHeapTypeRtt); - assert(Type(rtt).getID() != Type(otherHeapTypeRtt).getID()); - - Rtt structRtt(0, Struct{}); - assert(Type(structRtt).getID() == Type(structRtt).getID()); - - Rtt sameStructRtt(0, Struct{}); - assert(structRtt == sameStructRtt); - assert(Type(structRtt).getID() == Type(sameStructRtt).getID()); - - Rtt otherStructRtt(0, Struct({{Type::i32, Immutable}})); - assert(structRtt != otherStructRtt); - assert(Type(structRtt).getID() != Type(otherStructRtt).getID()); - } } void test_printing() { @@ -190,26 +163,6 @@ void test_printing() { std::cout << Type(tuple) << "\n"; } { - std::cout << "\n;; Rtt\n"; - std::cout << Rtt(0, HeapType::func) << "\n"; - std::cout << Type(Rtt(0, HeapType::func)) << "\n"; - std::cout << Rtt(2, HeapType::any) << "\n"; - std::cout << Type(Rtt(2, HeapType::any)) << "\n"; - std::cout << Rtt(3, HeapType::eq) << "\n"; - std::cout << Type(Rtt(3, HeapType::eq)) << "\n"; - std::cout << Rtt(4, HeapType::i31) << "\n"; - std::cout << Type(Rtt(4, HeapType::i31)) << "\n"; - Rtt signatureRtt(6, Signature(Type::none, Type::none)); - std::cout << signatureRtt << "\n"; - std::cout << Type(signatureRtt) << "\n"; - Rtt structRtt(7, Struct{}); - std::cout << structRtt << "\n"; - std::cout << Type(structRtt) << "\n"; - Rtt arrayRtt(8, Array({Type::i32, Immutable})); - std::cout << arrayRtt << "\n"; - std::cout << Type(arrayRtt) << "\n"; - } - { std::cout << "\n;; Signature of references (param/result)\n"; Signature signature(Type(Struct{}, Nullable), Type(Array({Type::i32, Mutable}), NonNullable)); diff --git a/test/example/typeinfo.txt b/test/example/typeinfo.txt index 838fd34a3..2fbd8ec52 100644 --- a/test/example/typeinfo.txt +++ b/test/example/typeinfo.txt @@ -45,22 +45,6 @@ none (i32 f64) (i32 f64) -;; Rtt -(rtt 0 func) -(rtt 0 func) -(rtt 2 any) -(rtt 2 any) -(rtt 3 eq) -(rtt 3 eq) -(rtt 4 i31) -(rtt 4 i31) -(rtt 6 $func.0) -(rtt 6 $func.0) -(rtt 7 $struct.0) -(rtt 7 $struct.0) -(rtt 8 $array.0) -(rtt 8 $array.0) - ;; Signature of references (param/result) (func (param (ref null $struct.0)) (result (ref $array.0))) |