1;;! target = "riscv64"
2;;! test = 'optimize'
3;;! filter = 'wasm[2]--function[1]'
4
5(component
6  (type $a (enum "a" "b" "c"))
7  (type $func_ty (func (param "x" $a)))
8
9  (component $c1
10    (import "a" (type $a' (eq $a)))
11    (core module $m1
12      (func (export "f") (result i32)
13        (i32.const 0)))
14    (core instance $ci1 (instantiate $m1))
15    (func (export "f") (result $a') (canon lift (core func $ci1 "f"))))
16
17  (component $c2
18    (import "a" (type $a' (eq $a)))
19    (import "f" (func $f (result $a')))
20    (core func $g (canon lower (func $f)))
21    (core module $m2
22      (import "" "f" (func (result i32)))
23      (func (export "f") (result i32) (call 0)))
24    (core instance $ci2
25      (instantiate $m2 (with "" (instance (export "f" (func $g))))))
26    (func (export "f") (result $a') (canon lift (core func $ci2 "f"))))
27
28  (instance $i1 (instantiate $c1 (with "a" (type $a))))
29  (instance $i2 (instantiate $c2
30                  (with "a" (type $a))
31                  (with "f" (func $i1 "f"))))
32)
33
34