Debian Codegraph @

tests/cli/component-model-gc/enum-types.wast

raw
1 ;; RUN: wast --assert default --snapshot tests/snapshots % -f gc,cm-gc
2
3 (component
4 (type $enum (enum "a" "b" "c"))
5
6 (core type $ty (func (param i32)))
7
8 (import "i" (instance $i
9 (export "ty" (type $enum' (eq $enum)))
10 (export "f" (func (param "x" $enum')))))
11 (core func (canon lower (func $i "f") gc string-encoding=utf8 (core-type $ty)))
12 )
13
14 (assert_invalid
15 (component
16 (type $enum (enum "a" "b" "c"))
17
18 (core type $ty (func (param anyref)))
19
20 (import "i" (instance $i
21 (export "ty" (type $enum' (eq $enum)))
22 (export "f" (func (param "x" $enum')))))
23 (core func (canon lower (func $i "f") gc string-encoding=utf8 (core-type $ty)))
24 )
25 "expected to lower component `enum` type into core `i32` type, but found `anyref`"
26 )