summaryrefslogtreecommitdiff
path: root/test/lit/nominal-chain.wast
blob: bf190d8780701c7857829f04bdc84db96a324ac1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: wasm-opt %s -all --nominal -S -o - | filecheck %s
;; RUN: wasm-opt %s -all --nominal --roundtrip -S -o - | filecheck %s

;; Check that intermediate types in subtype chains are also included in the
;; output module, even if there are no other references to those intermediate
;; types.

(module
  ;; CHECK:      (type $root (struct ))

  ;; CHECK:      (type $leaf (struct (field i32) (field i64) (field f32) (field f64)) (extends $twig))
  (type $leaf (struct i32 i64 f32 f64) (extends $twig))

  ;; CHECK:      (type $twig (struct (field i32) (field i64) (field f32)) (extends $branch))
  (type $twig (struct i32 i64 f32) (extends $branch))

  ;; CHECK:      (type $branch (struct (field i32) (field i64)) (extends $trunk))
  (type $branch (struct i32 i64) (extends $trunk))

  ;; CHECK:      (type $trunk (struct (field i32)) (extends $root))
  (type $trunk (struct i32) (extends $root))

  (type $root (struct))

  ;; CHECK:      (func $make-root (result (ref null $root))
  ;; CHECK-NEXT:  (ref.null $leaf)
  ;; CHECK-NEXT: )
  (func $make-root (result (ref null $root))
    (ref.null $leaf)
  )
)