| 1 |
;; RUN: wast --assert default --snapshot tests/snapshots % -f gc,cm-gc |
| 2 |
|
| 3 |
;; bool |
| 4 |
|
| 5 |
(component |
| 6 |
(import "f" (func $f (param "x" bool))) |
| 7 |
(core type $ty (func (param i32))) |
| 8 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 9 |
) |
| 10 |
|
| 11 |
(assert_invalid |
| 12 |
(component |
| 13 |
(import "f" (func $f (param "x" bool))) |
| 14 |
(core type $ty (func (param anyref))) |
| 15 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 16 |
) |
| 17 |
"expected to lower component `bool` type to core `i32` type, found `anyref`" |
| 18 |
) |
| 19 |
|
| 20 |
(component |
| 21 |
(import "f" (func $f (param "x" (list bool)))) |
| 22 |
(core type $list (array i8)) |
| 23 |
(core type $ty (func (param (ref $list)))) |
| 24 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 25 |
) |
| 26 |
|
| 27 |
(assert_invalid |
| 28 |
(component |
| 29 |
(import "f" (func $f (param "x" (list bool)))) |
| 30 |
(core type $list (array i32)) |
| 31 |
(core type $ty (func (param (ref $list)))) |
| 32 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 33 |
) |
| 34 |
"expected to lower component `bool` type to core `i8` type, found `i32`" |
| 35 |
) |
| 36 |
|
| 37 |
;; u8 |
| 38 |
|
| 39 |
(component |
| 40 |
(import "f" (func $f (param "x" u8))) |
| 41 |
(core type $ty (func (param i32))) |
| 42 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 43 |
) |
| 44 |
|
| 45 |
(assert_invalid |
| 46 |
(component |
| 47 |
(import "f" (func $f (param "x" u8))) |
| 48 |
(core type $ty (func (param anyref))) |
| 49 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 50 |
) |
| 51 |
"expected to lower component `u8` type to core `i32` type, found `anyref`" |
| 52 |
) |
| 53 |
|
| 54 |
(component |
| 55 |
(import "f" (func $f (param "x" (list u8)))) |
| 56 |
(core type $list (array i8)) |
| 57 |
(core type $ty (func (param (ref $list)))) |
| 58 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 59 |
) |
| 60 |
|
| 61 |
(assert_invalid |
| 62 |
(component |
| 63 |
(import "f" (func $f (param "x" (list u8)))) |
| 64 |
(core type $list (array i32)) |
| 65 |
(core type $ty (func (param (ref $list)))) |
| 66 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 67 |
) |
| 68 |
"expected to lower component `u8` type to core `i8` type, found `i32`" |
| 69 |
) |
| 70 |
|
| 71 |
;; s8 |
| 72 |
|
| 73 |
(component |
| 74 |
(import "f" (func $f (param "x" s8))) |
| 75 |
(core type $ty (func (param i32))) |
| 76 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 77 |
) |
| 78 |
|
| 79 |
(assert_invalid |
| 80 |
(component |
| 81 |
(import "f" (func $f (param "x" s8))) |
| 82 |
(core type $ty (func (param anyref))) |
| 83 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 84 |
) |
| 85 |
"expected to lower component `s8` type to core `i32` type, found `anyref`" |
| 86 |
) |
| 87 |
|
| 88 |
(component |
| 89 |
(import "f" (func $f (param "x" (list s8)))) |
| 90 |
(core type $list (array i8)) |
| 91 |
(core type $ty (func (param (ref $list)))) |
| 92 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 93 |
) |
| 94 |
|
| 95 |
(assert_invalid |
| 96 |
(component |
| 97 |
(import "f" (func $f (param "x" (list s8)))) |
| 98 |
(core type $list (array i32)) |
| 99 |
(core type $ty (func (param (ref $list)))) |
| 100 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 101 |
) |
| 102 |
"expected to lower component `s8` type to core `i8` type, found `i32`" |
| 103 |
) |
| 104 |
|
| 105 |
;; u16 |
| 106 |
|
| 107 |
(component |
| 108 |
(import "f" (func $f (param "x" u16))) |
| 109 |
(core type $ty (func (param i32))) |
| 110 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 111 |
) |
| 112 |
|
| 113 |
(assert_invalid |
| 114 |
(component |
| 115 |
(import "f" (func $f (param "x" u16))) |
| 116 |
(core type $ty (func (param anyref))) |
| 117 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 118 |
) |
| 119 |
"expected to lower component `u16` type to core `i32` type, found `anyref`" |
| 120 |
) |
| 121 |
|
| 122 |
(component |
| 123 |
(import "f" (func $f (param "x" (list u16)))) |
| 124 |
(core type $list (array i16)) |
| 125 |
(core type $ty (func (param (ref $list)))) |
| 126 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 127 |
) |
| 128 |
|
| 129 |
(assert_invalid |
| 130 |
(component |
| 131 |
(import "f" (func $f (param "x" (list u16)))) |
| 132 |
(core type $list (array i32)) |
| 133 |
(core type $ty (func (param (ref $list)))) |
| 134 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 135 |
) |
| 136 |
"expected to lower component `u16` type to core `i16` type, found `i32`" |
| 137 |
) |
| 138 |
|
| 139 |
;; s16 |
| 140 |
|
| 141 |
(component |
| 142 |
(import "f" (func $f (param "x" s16))) |
| 143 |
(core type $ty (func (param i32))) |
| 144 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 145 |
) |
| 146 |
|
| 147 |
(assert_invalid |
| 148 |
(component |
| 149 |
(import "f" (func $f (param "x" s16))) |
| 150 |
(core type $ty (func (param anyref))) |
| 151 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 152 |
) |
| 153 |
"expected to lower component `s16` type to core `i32` type, found `anyref`" |
| 154 |
) |
| 155 |
|
| 156 |
(component |
| 157 |
(import "f" (func $f (param "x" (list s16)))) |
| 158 |
(core type $list (array i16)) |
| 159 |
(core type $ty (func (param (ref $list)))) |
| 160 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 161 |
) |
| 162 |
|
| 163 |
(assert_invalid |
| 164 |
(component |
| 165 |
(import "f" (func $f (param "x" (list s16)))) |
| 166 |
(core type $list (array i32)) |
| 167 |
(core type $ty (func (param (ref $list)))) |
| 168 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 169 |
) |
| 170 |
"expected to lower component `s16` type to core `i16` type, found `i32`" |
| 171 |
) |
| 172 |
|
| 173 |
;; u32 |
| 174 |
|
| 175 |
(component |
| 176 |
(import "f" (func $f (param "x" u32))) |
| 177 |
(core type $ty (func (param i32))) |
| 178 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 179 |
) |
| 180 |
|
| 181 |
(assert_invalid |
| 182 |
(component |
| 183 |
(import "f" (func $f (param "x" u32))) |
| 184 |
(core type $ty (func (param anyref))) |
| 185 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 186 |
) |
| 187 |
"expected to lower component `u32` type to core `i32` type, found `anyref`" |
| 188 |
) |
| 189 |
|
| 190 |
(component |
| 191 |
(import "f" (func $f (param "x" (list u32)))) |
| 192 |
(core type $list (array i32)) |
| 193 |
(core type $ty (func (param (ref $list)))) |
| 194 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 195 |
) |
| 196 |
|
| 197 |
(assert_invalid |
| 198 |
(component |
| 199 |
(import "f" (func $f (param "x" (list u32)))) |
| 200 |
(core type $list (array anyref)) |
| 201 |
(core type $ty (func (param (ref $list)))) |
| 202 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 203 |
) |
| 204 |
"expected to lower component `u32` type to core `i32` type, found `anyref`" |
| 205 |
) |
| 206 |
|
| 207 |
;; s32 |
| 208 |
|
| 209 |
(component |
| 210 |
(import "f" (func $f (param "x" s32))) |
| 211 |
(core type $ty (func (param i32))) |
| 212 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 213 |
) |
| 214 |
|
| 215 |
(assert_invalid |
| 216 |
(component |
| 217 |
(import "f" (func $f (param "x" s32))) |
| 218 |
(core type $ty (func (param anyref))) |
| 219 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 220 |
) |
| 221 |
"expected to lower component `s32` type to core `i32` type, found `anyref`" |
| 222 |
) |
| 223 |
|
| 224 |
(component |
| 225 |
(import "f" (func $f (param "x" (list s32)))) |
| 226 |
(core type $list (array i32)) |
| 227 |
(core type $ty (func (param (ref $list)))) |
| 228 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 229 |
) |
| 230 |
|
| 231 |
(assert_invalid |
| 232 |
(component |
| 233 |
(import "f" (func $f (param "x" (list s32)))) |
| 234 |
(core type $list (array anyref)) |
| 235 |
(core type $ty (func (param (ref $list)))) |
| 236 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 237 |
) |
| 238 |
"expected to lower component `s32` type to core `i32` type, found `anyref`" |
| 239 |
) |
| 240 |
|
| 241 |
;; u64 |
| 242 |
|
| 243 |
(component |
| 244 |
(import "f" (func $f (param "x" u64))) |
| 245 |
(core type $ty (func (param i64))) |
| 246 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 247 |
) |
| 248 |
|
| 249 |
(assert_invalid |
| 250 |
(component |
| 251 |
(import "f" (func $f (param "x" u64))) |
| 252 |
(core type $ty (func (param anyref))) |
| 253 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 254 |
) |
| 255 |
"expected to lower component `u64` type to core `i64` type, found `anyref`" |
| 256 |
) |
| 257 |
|
| 258 |
(component |
| 259 |
(import "f" (func $f (param "x" (list u64)))) |
| 260 |
(core type $list (array i64)) |
| 261 |
(core type $ty (func (param (ref $list)))) |
| 262 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 263 |
) |
| 264 |
|
| 265 |
(assert_invalid |
| 266 |
(component |
| 267 |
(import "f" (func $f (param "x" (list u64)))) |
| 268 |
(core type $list (array anyref)) |
| 269 |
(core type $ty (func (param (ref $list)))) |
| 270 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 271 |
) |
| 272 |
"expected to lower component `u64` type to core `i64` type, found `anyref`" |
| 273 |
) |
| 274 |
|
| 275 |
;; s64 |
| 276 |
|
| 277 |
(component |
| 278 |
(import "f" (func $f (param "x" s64))) |
| 279 |
(core type $ty (func (param i64))) |
| 280 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 281 |
) |
| 282 |
|
| 283 |
(assert_invalid |
| 284 |
(component |
| 285 |
(import "f" (func $f (param "x" s64))) |
| 286 |
(core type $ty (func (param anyref))) |
| 287 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 288 |
) |
| 289 |
"expected to lower component `s64` type to core `i64` type, found `anyref`" |
| 290 |
) |
| 291 |
|
| 292 |
(component |
| 293 |
(import "f" (func $f (param "x" (list s64)))) |
| 294 |
(core type $list (array i64)) |
| 295 |
(core type $ty (func (param (ref $list)))) |
| 296 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 297 |
) |
| 298 |
|
| 299 |
(assert_invalid |
| 300 |
(component |
| 301 |
(import "f" (func $f (param "x" (list s64)))) |
| 302 |
(core type $list (array anyref)) |
| 303 |
(core type $ty (func (param (ref $list)))) |
| 304 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 305 |
) |
| 306 |
"expected to lower component `s64` type to core `i64` type, found `anyref`" |
| 307 |
) |
| 308 |
|
| 309 |
;; f32 |
| 310 |
|
| 311 |
(component |
| 312 |
(import "f" (func $f (param "x" f32))) |
| 313 |
(core type $ty (func (param f32))) |
| 314 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 315 |
) |
| 316 |
|
| 317 |
(assert_invalid |
| 318 |
(component |
| 319 |
(import "f" (func $f (param "x" f32))) |
| 320 |
(core type $ty (func (param anyref))) |
| 321 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 322 |
) |
| 323 |
"expected to lower component `f32` type to core `f32` type, found `anyref`" |
| 324 |
) |
| 325 |
|
| 326 |
(component |
| 327 |
(import "f" (func $f (param "x" (list f32)))) |
| 328 |
(core type $list (array f32)) |
| 329 |
(core type $ty (func (param (ref $list)))) |
| 330 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 331 |
) |
| 332 |
|
| 333 |
(assert_invalid |
| 334 |
(component |
| 335 |
(import "f" (func $f (param "x" (list f32)))) |
| 336 |
(core type $list (array anyref)) |
| 337 |
(core type $ty (func (param (ref $list)))) |
| 338 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 339 |
) |
| 340 |
"expected to lower component `f32` type to core `f32` type, found `anyref`" |
| 341 |
) |
| 342 |
|
| 343 |
;; f64 |
| 344 |
|
| 345 |
(component |
| 346 |
(import "f" (func $f (param "x" f64))) |
| 347 |
(core type $ty (func (param f64))) |
| 348 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 349 |
) |
| 350 |
|
| 351 |
(assert_invalid |
| 352 |
(component |
| 353 |
(import "f" (func $f (param "x" f64))) |
| 354 |
(core type $ty (func (param anyref))) |
| 355 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 356 |
) |
| 357 |
"expected to lower component `f64` type to core `f64` type, found `anyref`" |
| 358 |
) |
| 359 |
|
| 360 |
(component |
| 361 |
(import "f" (func $f (param "x" (list f64)))) |
| 362 |
(core type $list (array f64)) |
| 363 |
(core type $ty (func (param (ref $list)))) |
| 364 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 365 |
) |
| 366 |
|
| 367 |
(assert_invalid |
| 368 |
(component |
| 369 |
(import "f" (func $f (param "x" (list f64)))) |
| 370 |
(core type $list (array anyref)) |
| 371 |
(core type $ty (func (param (ref $list)))) |
| 372 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 373 |
) |
| 374 |
"expected to lower component `f64` type to core `f64` type, found `anyref`" |
| 375 |
) |
| 376 |
|
| 377 |
;; char |
| 378 |
|
| 379 |
(component |
| 380 |
(import "f" (func $f (param "x" char))) |
| 381 |
(core type $ty (func (param i32))) |
| 382 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 383 |
) |
| 384 |
|
| 385 |
(assert_invalid |
| 386 |
(component |
| 387 |
(import "f" (func $f (param "x" char))) |
| 388 |
(core type $ty (func (param anyref))) |
| 389 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 390 |
) |
| 391 |
"expected to lower component `char` type to core `i32` type, found `anyref`" |
| 392 |
) |
| 393 |
|
| 394 |
(component |
| 395 |
(import "f" (func $f (param "x" (list char)))) |
| 396 |
(core type $list (array i32)) |
| 397 |
(core type $ty (func (param (ref $list)))) |
| 398 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 399 |
) |
| 400 |
|
| 401 |
(assert_invalid |
| 402 |
(component |
| 403 |
(import "f" (func $f (param "x" (list char)))) |
| 404 |
(core type $list (array anyref)) |
| 405 |
(core type $ty (func (param (ref $list)))) |
| 406 |
(core func (canon lower (func $f) gc (core-type $ty))) |
| 407 |
) |
| 408 |
"expected to lower component `char` type to core `i32` type, found `anyref`" |
| 409 |
) |
| 410 |
|
| 411 |
;; utf8 strings |
| 412 |
|
| 413 |
(component |
| 414 |
(import "f" (func $f (param "x" string))) |
| 415 |
(core type $s (array i8)) |
| 416 |
(core type $ty (func (param (ref $s)))) |
| 417 |
(core func (canon lower (func $f) gc string-encoding=utf8 (core-type $ty))) |
| 418 |
) |
| 419 |
|
| 420 |
(assert_invalid |
| 421 |
(component |
| 422 |
(import "f" (func $f (param "x" string))) |
| 423 |
(core type $ty (func (param anyref))) |
| 424 |
(core func (canon lower (func $f) gc string-encoding=utf8 (core-type $ty))) |
| 425 |
) |
| 426 |
"expected to lower component `string` type to core `(ref null? (array (mut? i8)))` type, found `anyref`" |
| 427 |
) |
| 428 |
|
| 429 |
(component |
| 430 |
(import "f" (func $f (param "x" (list string)))) |
| 431 |
(core type $s (array i8)) |
| 432 |
(core type $list (array (ref $s))) |
| 433 |
(core type $ty (func (param (ref $list)))) |
| 434 |
(core func (canon lower (func $f) gc string-encoding=utf8 (core-type $ty))) |
| 435 |
) |
| 436 |
|
| 437 |
(assert_invalid |
| 438 |
(component |
| 439 |
(import "f" (func $f (param "x" (list string)))) |
| 440 |
(core type $list (array anyref)) |
| 441 |
(core type $ty (func (param (ref $list)))) |
| 442 |
(core func (canon lower (func $f) gc string-encoding=utf8 (core-type $ty))) |
| 443 |
) |
| 444 |
"expected to lower component `string` type to core `(ref null? (array (mut? i8)))` type, found `anyref`" |
| 445 |
) |
| 446 |
|
| 447 |
;; utf16 strings |
| 448 |
|
| 449 |
(component |
| 450 |
(import "f" (func $f (param "x" string))) |
| 451 |
(core type $s (array i16)) |
| 452 |
(core type $ty (func (param (ref $s)))) |
| 453 |
(core func (canon lower (func $f) gc string-encoding=utf16 (core-type $ty))) |
| 454 |
) |
| 455 |
|
| 456 |
(assert_invalid |
| 457 |
(component |
| 458 |
(import "f" (func $f (param "x" string))) |
| 459 |
(core type $ty (func (param anyref))) |
| 460 |
(core func (canon lower (func $f) gc string-encoding=utf16 (core-type $ty))) |
| 461 |
) |
| 462 |
"expected to lower component `string` type to core `(ref null? (array (mut? i16)))` type, found `anyref`" |
| 463 |
) |
| 464 |
|
| 465 |
(component |
| 466 |
(import "f" (func $f (param "x" (list string)))) |
| 467 |
(core type $s (array i16)) |
| 468 |
(core type $list (array (ref $s))) |
| 469 |
(core type $ty (func (param (ref $list)))) |
| 470 |
(core func (canon lower (func $f) gc string-encoding=utf16 (core-type $ty))) |
| 471 |
) |
| 472 |
|
| 473 |
(assert_invalid |
| 474 |
(component |
| 475 |
(import "f" (func $f (param "x" (list string)))) |
| 476 |
(core type $list (array anyref)) |
| 477 |
(core type $ty (func (param (ref $list)))) |
| 478 |
(core func (canon lower (func $f) gc string-encoding=utf16 (core-type $ty))) |
| 479 |
) |
| 480 |
"expected to lower component `string` type to core `(ref null? (array (mut? i16)))` type, found `anyref`" |
| 481 |
) |
| 482 |
|
| 483 |
;; compact utf16 strings |
| 484 |
|
| 485 |
(component |
| 486 |
(import "f" (func $f (param "x" string))) |
| 487 |
(core type $s (array i8)) |
| 488 |
(core type $ty (func (param (ref $s)))) |
| 489 |
(core func (canon lower (func $f) gc string-encoding=latin1+utf16 (core-type $ty))) |
| 490 |
) |
| 491 |
|
| 492 |
(assert_invalid |
| 493 |
(component |
| 494 |
(import "f" (func $f (param "x" string))) |
| 495 |
(core type $ty (func (param anyref))) |
| 496 |
(core func (canon lower (func $f) gc string-encoding=latin1+utf16 (core-type $ty))) |
| 497 |
) |
| 498 |
"expected to lower component `string` type to core `(ref null? (array (mut? i8)))` type, found `anyref`" |
| 499 |
) |
| 500 |
|
| 501 |
(component |
| 502 |
(import "f" (func $f (param "x" (list string)))) |
| 503 |
(core type $s (array i8)) |
| 504 |
(core type $list (array (ref $s))) |
| 505 |
(core type $ty (func (param (ref $list)))) |
| 506 |
(core func (canon lower (func $f) gc string-encoding=latin1+utf16 (core-type $ty))) |
| 507 |
) |
| 508 |
|
| 509 |
(assert_invalid |
| 510 |
(component |
| 511 |
(import "f" (func $f (param "x" (list string)))) |
| 512 |
(core type $list (array anyref)) |
| 513 |
(core type $ty (func (param (ref $list)))) |
| 514 |
(core func (canon lower (func $f) gc string-encoding=latin1+utf16 (core-type $ty))) |
| 515 |
) |
| 516 |
"expected to lower component `string` type to core `(ref null? (array (mut? i8)))` type, found `anyref`" |
| 517 |
) |