diff options
Diffstat (limited to 'test/lit/passes/local-subtyping-nn.wast')
-rw-r--r-- | test/lit/passes/local-subtyping-nn.wast | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/test/lit/passes/local-subtyping-nn.wast b/test/lit/passes/local-subtyping-nn.wast index bcf13f7c2..290fe032d 100644 --- a/test/lit/passes/local-subtyping-nn.wast +++ b/test/lit/passes/local-subtyping-nn.wast @@ -2,13 +2,15 @@ ;; RUN: wasm-opt %s --local-subtyping -all --enable-gc-nn-locals -S -o - \ ;; RUN: | filecheck %s ;; RUN: wasm-opt %s --local-subtyping -all --enable-gc-nn-locals --nominal -S -o - \ -;; RUN: | filecheck %s +;; RUN: | filecheck %s --check-prefix=NOMNL (module ;; CHECK: (type $struct (struct )) + ;; NOMNL: (type $struct (struct_subtype data)) (type $struct (struct)) ;; CHECK: (import "out" "i32" (func $i32 (result i32))) + ;; NOMNL: (import "out" "i32" (func $i32 (result i32))) (import "out" "i32" (func $i32 (result i32))) ;; CHECK: (func $non-nullable @@ -26,6 +28,21 @@ ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + ;; NOMNL: (func $non-nullable + ;; NOMNL-NEXT: (local $x (ref $struct)) + ;; NOMNL-NEXT: (local $y (ref $none_=>_i32)) + ;; NOMNL-NEXT: (local.set $x + ;; NOMNL-NEXT: (ref.as_non_null + ;; NOMNL-NEXT: (ref.null $struct) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: (local.set $y + ;; NOMNL-NEXT: (ref.func $i32) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: (drop + ;; NOMNL-NEXT: (local.get $x) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: ) (func $non-nullable (local $x (ref null $struct)) (local $y anyref) @@ -58,6 +75,20 @@ ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) + ;; NOMNL: (func $uses-default (param $i i32) + ;; NOMNL-NEXT: (local $x (ref null $struct)) + ;; NOMNL-NEXT: (if + ;; NOMNL-NEXT: (local.get $i) + ;; NOMNL-NEXT: (local.set $x + ;; NOMNL-NEXT: (ref.as_non_null + ;; NOMNL-NEXT: (ref.null $struct) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: (drop + ;; NOMNL-NEXT: (local.get $x) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: ) (func $uses-default (param $i i32) (local $x (ref null any)) (if |