|
| 1 | +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. |
| 2 | + |
| 3 | +;; RUN: wasm-merge %s primary %s.second secondary --skip-export-conflicts -all -S -o - | filecheck %s |
| 4 | + |
| 5 | +;; Export a function with a subtype. It is imported using the supertype, and |
| 6 | +;; after we merge, the refined return type must be updated - the call |
| 7 | +;; instruction now returns something new. |
| 8 | +(module |
| 9 | + ;; CHECK: (type $0 (func (result anyref))) |
| 10 | + |
| 11 | + ;; CHECK: (type $super (sub (func (param i32) (result anyref)))) |
| 12 | + (type $super (sub (func (param i32) (result anyref)))) |
| 13 | + |
| 14 | + ;; CHECK: (type $sub (sub final $super (func (param i32) (result (ref any))))) |
| 15 | + (type $sub (sub final $super (func (param i32) (result (ref any))))) |
| 16 | + |
| 17 | + ;; CHECK: (export "sub" (func $sub)) |
| 18 | + |
| 19 | + ;; CHECK: (export "caller" (func $caller)) |
| 20 | + |
| 21 | + ;; CHECK: (export "caller-unreachable" (func $caller-unreachable)) |
| 22 | + |
| 23 | + ;; CHECK: (func $sub (type $sub) (param $0 i32) (result (ref any)) |
| 24 | + ;; CHECK-NEXT: (unreachable) |
| 25 | + ;; CHECK-NEXT: ) |
| 26 | + (func $sub (export "sub") (type $sub) |
| 27 | + (unreachable) |
| 28 | + ) |
| 29 | +) |
| 30 | + |
| 31 | +;; CHECK: (func $caller (type $0) (result anyref) |
| 32 | +;; CHECK-NEXT: (block $block (result (ref any)) |
| 33 | +;; CHECK-NEXT: (call $sub |
| 34 | +;; CHECK-NEXT: (i32.const 42) |
| 35 | +;; CHECK-NEXT: ) |
| 36 | +;; CHECK-NEXT: ) |
| 37 | +;; CHECK-NEXT: ) |
| 38 | + |
| 39 | +;; CHECK: (func $caller-unreachable (type $0) (result anyref) |
| 40 | +;; CHECK-NEXT: (block $block |
| 41 | +;; CHECK-NEXT: (call $sub |
| 42 | +;; CHECK-NEXT: (unreachable) |
| 43 | +;; CHECK-NEXT: ) |
| 44 | +;; CHECK-NEXT: ) |
| 45 | +;; CHECK-NEXT: ) |
0 commit comments