(module
(type $ft (;0;) (func))
(type $st (;1;) (struct))
(type $at (;2;) (array i8))
(type (;3;) (func (param externref)))
(type (;4;) (func (param i32)))
(table (;0;) 10 anyref)
(export "init" (func 1))
(export "ref_cast_non_null" (func 2))
(export "ref_cast_null" (func 3))
(export "ref_cast_i31" (func 4))
(export "ref_cast_struct" (func 5))
(export "ref_cast_array" (func 6))
(elem (;0;) declare func $f)
(func $f (;0;) (type $ft))
(func (;1;) (type 3) (param $x externref)
(table.set 0 (; [] ;)
(i32.const 0 (; [i32] ;))
(ref.null any (; [i32 anyref] ;)))
(table.set 0 (; [] ;)
(i32.const 1 (; [i32] ;))
(ref.i31 (; [i32 (ref i31)] ;)
(i32.const 7 (; [i32 i32] ;))))
(table.set 0 (; [] ;)
(i32.const 2 (; [i32] ;))
(struct.new_default $st (; [i32 (ref (exact (id 1)))] ;)))
(table.set 0 (; [] ;)
(i32.const 3 (; [i32] ;))
(array.new_default $at (; [i32 (ref (exact (id 2)))] ;)
(i32.const 0 (; [i32 i32] ;))))
(table.set 0 (; [] ;)
(i32.const 4 (; [i32] ;))
(any.convert_extern (; [i32 anyref] ;)
(local.get $x (; [i32 externref] ;))))
(table.set 0 (; [] ;)
(i32.const 5 (; [i32] ;))
(ref.null i31 (; [i32 i31ref] ;)))
(table.set 0 (; [] ;)
(i32.const 6 (; [i32] ;))
(ref.null struct (; [i32 structref] ;)))
(table.set 0 (; [] ;)
(i32.const 7 (; [i32] ;))
(ref.null none (; [i32 nullref] ;)))
)
(func (;2;) (type 4) (param $i i32)
(drop (; [] ;)
(ref.as_non_null (; [(ref any)] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
(drop (; [] ;)
(ref.cast anyref (; [anyref] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
)
(func (;3;) (type 4) (param $i i32)
(drop (; [] ;)
(ref.cast anyref (; [anyref] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
(drop (; [] ;)
(ref.cast structref (; [structref] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
(drop (; [] ;)
(ref.cast arrayref (; [arrayref] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
(drop (; [] ;)
(ref.cast i31ref (; [i31ref] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
(drop (; [] ;)
(ref.cast nullref (; [nullref] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
)
(func (;4;) (type 4) (param $i i32)
(drop (; [] ;)
(ref.cast (ref i31) (; [(ref i31)] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
(drop (; [] ;)
(ref.cast i31ref (; [i31ref] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
)
(func (;5;) (type 4) (param $i i32)
(drop (; [] ;)
(ref.cast (ref struct) (; [(ref struct)] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
(drop (; [] ;)
(ref.cast structref (; [structref] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
)
(func (;6;) (type 4) (param $i i32)
(drop (; [] ;)
(ref.cast (ref array) (; [(ref array)] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
(drop (; [] ;)
(ref.cast arrayref (; [arrayref] ;)
(table.get 0 (; [anyref] ;)
(local.get $i (; [i32] ;)))))
)
)