Skip to content

Commit 9660b28

Browse files
authored
Merge pull request WebAssembly#116 from fitzgen/test-return-call-more-results
Test `return_call*`s to callees that return more values than the caller does
2 parents 8475cff + 013cf5d commit 9660b28

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

test/core/return_call.wast

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,15 @@
188188
)
189189
"type mismatch"
190190
)
191-
191+
(assert_invalid
192+
(module
193+
(func $f (result i32 i32) unreachable)
194+
(func (result i32)
195+
return_call $f
196+
)
197+
)
198+
"type mismatch"
199+
)
192200

193201
;; Unbound function
194202

test/core/return_call_indirect.wast

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,17 @@
508508
)
509509
"type mismatch"
510510
)
511-
511+
(assert_invalid
512+
(module
513+
(type $ty (func (result i32 i32)))
514+
(import "env" "table" (table $table 0 funcref))
515+
(func (param i32) (result i32)
516+
local.get 0
517+
return_call_indirect $table (type $ty)
518+
)
519+
)
520+
"type mismatch"
521+
)
512522

513523
;; Unbound type
514524

test/core/return_call_ref.wast

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,14 @@
374374
)
375375
"type mismatch"
376376
)
377+
378+
(assert_invalid
379+
(module
380+
(type $ty (func (result i32 i32)))
381+
(func (param funcref) (result i32)
382+
local.get 0
383+
return_call_ref $ty
384+
)
385+
)
386+
"type mismatch"
387+
)

0 commit comments

Comments
 (0)