| 1 |
;; RUN: wast --assert default --snapshot tests/snapshots % -f gc,cm-gc |
| 2 |
|
| 3 |
(component |
| 4 |
(core type $ty (func (param externref))) |
| 5 |
|
| 6 |
(import "i" (instance $i |
| 7 |
(export "r" (type $resource (sub resource))) |
| 8 |
(export "f" (func (param "x" (own $resource)))))) |
| 9 |
(core func (canon lower (func $i "f") gc string-encoding=utf8 (core-type $ty))) |
| 10 |
) |
| 11 |
|
| 12 |
(assert_invalid |
| 13 |
(component |
| 14 |
(core type $ty (func (param anyref))) |
| 15 |
|
| 16 |
(import "i" (instance $i |
| 17 |
(export "r" (type $resource (sub resource))) |
| 18 |
(export "f" (func (param "x" (own $resource)))))) |
| 19 |
(core func (canon lower (func $i "f") gc string-encoding=utf8 (core-type $ty))) |
| 20 |
) |
| 21 |
"expected to lower component `own` type into core `(ref null? extern)` type, but found `anyref`" |
| 22 |
) |
| 23 |
|
| 24 |
(component |
| 25 |
(core type $ty (func (param externref))) |
| 26 |
|
| 27 |
(import "i" (instance $i |
| 28 |
(export "r" (type $resource (sub resource))) |
| 29 |
(export "f" (func (param "x" (borrow $resource)))))) |
| 30 |
(core func (canon lower (func $i "f") gc string-encoding=utf8 (core-type $ty))) |
| 31 |
) |
| 32 |
|
| 33 |
(assert_invalid |
| 34 |
(component |
| 35 |
(core type $ty (func (param anyref))) |
| 36 |
|
| 37 |
(import "i" (instance $i |
| 38 |
(export "r" (type $resource (sub resource))) |
| 39 |
(export "f" (func (param "x" (borrow $resource)))))) |
| 40 |
(core func (canon lower (func $i "f") gc string-encoding=utf8 (core-type $ty))) |
| 41 |
) |
| 42 |
"expected to lower component `borrow` type into core `(ref null? extern)` type, but found `anyref`" |
| 43 |
) |