Skip to content

Commit ad92b39

Browse files
authored
Add a test for function subtyping (#127)
1 parent 03c6e4c commit ad92b39

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/core/stack-switching/cont.wast

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,27 @@
242242
(type $c2 (cont $f2))
243243
)
244244

245+
(assert_invalid
246+
(module
247+
(rec
248+
(type $fA (func))
249+
(type $fB (func))
250+
(type $cont (cont $fA))
251+
)
252+
(elem declare func $b)
253+
(func $a
254+
(drop
255+
(cont.new $cont ;; expects a ref of $fA, not $fB
256+
(ref.func $b)
257+
)
258+
)
259+
)
260+
(func $b (type $fB)
261+
)
262+
)
263+
"type mismatch")
264+
265+
245266
;; Test resume_throw used on the very first execution of a continuation (so the
246267
;; code in the continuation function is never reached).
247268
(module

0 commit comments

Comments
 (0)