diff options
Diffstat (limited to 'test/lit/isorecursive-good.wast')
-rw-r--r-- | test/lit/isorecursive-good.wast | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/lit/isorecursive-good.wast b/test/lit/isorecursive-good.wast new file mode 100644 index 000000000..353905c4f --- /dev/null +++ b/test/lit/isorecursive-good.wast @@ -0,0 +1,53 @@ +;; TODO: Autogenerate these checks! The current script cannot handle `rec`. + +;; RUN: wasm-opt %s -all --hybrid -S -o - | filecheck %s --check-prefix HYBRID +;; RUN: wasm-opt %s -all --nominal -S -o - | filecheck %s --check-prefix NOMINAL + +;; TDOO: test with --roundtrip as well + +(module + +;; HYBRID: (rec +;; HYBRID-NEXT: (type $super-struct (struct_subtype (field i32) data)) +;; HYBRID-NEXT: (type $sub-struct (struct_subtype (field i32) (field i64) $super-struct)) +;; HYBRID-NEXT: ) + +;; HYBRID: (rec +;; HYBRID-NEXT: (type $super-array (array_subtype (ref $super-struct) data)) +;; HYBRID-NEXT: (type $sub-array (array_subtype (ref $sub-struct) $super-array)) +;; HYBRID-NEXT: ) + +;; NOMINAL-NOT: rec + +;; NOMINAL: (type $super-struct (struct_subtype (field i32) data)) +;; NOMINAL-NEXT: (type $sub-struct (struct_subtype (field i32) (field i64) $super-struct)) + +;; NOMINAL: (type $super-array (array_subtype (ref $super-struct) data)) +;; NOMINAL-NEXT: (type $sub-array (array_subtype (ref $sub-struct) $super-array)) + + (rec + (type $super-struct (struct i32)) + (type $sub-struct (struct_subtype i32 i64 $super-struct)) + ) + + (rec + (type $super-array (array (ref $super-struct))) + (type $sub-array (array_subtype (ref $sub-struct) $super-array)) + ) + + (func $make-super-struct (result (ref $super-struct)) + (call $make-sub-struct) + ) + + (func $make-sub-struct (result (ref $sub-struct)) + (unreachable) + ) + + (func $make-super-array (result (ref $super-array)) + (call $make-sub-array) + ) + + (func $make-sub-array (result (ref $sub-array)) + (unreachable) + ) +) |