Skip to content

Commit c685a96

Browse files
committed
Resolve WebAssembly#17
This patch (re)installs the check for continuation type well-formedness.
1 parent 4310c76 commit c685a96

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

interpreter/valid/valid.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ let check_func_type (c : context) (ft : func_type) at =
183183

184184
let check_cont_type (c : context) (ct : cont_type) at =
185185
match ct with
186-
| ContT ft -> check_heap_type c ft at
186+
| ContT (VarHT (StatX x)) ->
187+
let _dt = func_type c (x @@ at) in ()
188+
| _ -> error at "ill-formed continuation type"
187189

188190
let check_table_type (c : context) (tt : table_type) at =
189191
let TableT (lim, t) = tt in

test/core/cont.wast

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,29 @@
205205
(drop)))
206206
"non-continuation type 0")
207207

208+
(assert_invalid
209+
(module
210+
(type $ct (cont $ct)))
211+
"non-function type 0")
212+
213+
(assert_invalid
214+
(module
215+
(rec
216+
(type $s0 (struct (field (ref 0) (ref 1) (ref $s0) (ref $s1))))
217+
(type $s1 (struct (field (ref 0) (ref 1) (ref $s0) (ref $s1))))
218+
)
219+
(type $ct (cont $s0)))
220+
"non-function type 0")
221+
222+
(module
223+
(rec
224+
(type $f1 (func (param (ref $f2))))
225+
(type $f2 (func (param (ref $f1))))
226+
)
227+
(type $c1 (cont $f1))
228+
(type $c2 (cont $f2))
229+
)
230+
208231
;; Simple state example
209232

210233
(module $state

0 commit comments

Comments
 (0)