| 1 |
;; RUN: wast --assert default --snapshot tests/snapshots % -f gc,cm-gc |
| 2 |
|
| 3 |
(component |
| 4 |
(type $tup (tuple string bool)) |
| 5 |
|
| 6 |
(core type $string (array i8)) |
| 7 |
(core type $tup (struct (field (ref $string)) |
| 8 |
(field i8))) |
| 9 |
(core type $ty (func (param (ref $tup)))) |
| 10 |
|
| 11 |
(import "i" (instance $i |
| 12 |
(export "ty" (type $tup' (eq $tup))) |
| 13 |
(export "f" (func (param "x" $tup'))))) |
| 14 |
(core func (canon lower (func $i "f") gc string-encoding=utf8 (core-type $ty))) |
| 15 |
) |
| 16 |
|
| 17 |
(assert_invalid |
| 18 |
(component |
| 19 |
(type $tup (tuple string bool)) |
| 20 |
|
| 21 |
(core type $string (array i8)) |
| 22 |
(core type $tup (struct (field (ref $string)))) |
| 23 |
(core type $ty (func (param (ref $tup)))) |
| 24 |
|
| 25 |
(import "i" (instance $i |
| 26 |
(export "ty" (type $tup' (eq $tup))) |
| 27 |
(export "f" (func (param "x" $tup'))))) |
| 28 |
(core func (canon lower (func $i "f") gc string-encoding=utf8 (core-type $ty))) |
| 29 |
) |
| 30 |
"core `struct` has 1 fields, but component `tuple` has 2 fields" |
| 31 |
) |
| 32 |
|
| 33 |
(assert_invalid |
| 34 |
(component |
| 35 |
(type $tup (tuple string bool)) |
| 36 |
|
| 37 |
(core type $string (array i8)) |
| 38 |
(core type $tup (struct (field (ref $string)) |
| 39 |
(field i8) |
| 40 |
(field i8))) |
| 41 |
(core type $ty (func (param (ref $tup)))) |
| 42 |
|
| 43 |
(import "i" (instance $i |
| 44 |
(export "ty" (type $tup' (eq $tup))) |
| 45 |
(export "f" (func (param "x" $tup'))))) |
| 46 |
(core func (canon lower (func $i "f") gc string-encoding=utf8 (core-type $ty))) |
| 47 |
) |
| 48 |
"core `struct` has 3 fields, but component `tuple` has 2 fields" |
| 49 |
) |
| 50 |
|
| 51 |
(assert_invalid |
| 52 |
(component |
| 53 |
(type $tup (tuple string bool)) |
| 54 |
|
| 55 |
(core type $ty (func (param i32))) |
| 56 |
|
| 57 |
(import "i" (instance $i |
| 58 |
(export "ty" (type $tup' (eq $tup))) |
| 59 |
(export "f" (func (param "x" $tup'))))) |
| 60 |
(core func (canon lower (func $i "f") gc string-encoding=utf8 (core-type $ty))) |
| 61 |
) |
| 62 |
"expected to lower component `tuple` type to core `(ref null? (struct ...))`, but found `i32`" |
| 63 |
) |