Skip to content

Commit

Permalink
Resolve #17
Browse files Browse the repository at this point in the history
This patch (re)installs the check for continuation type
well-formedness.
  • Loading branch information
dhil committed Jan 25, 2024
1 parent 4310c76 commit dd4644e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion interpreter/valid/valid.ml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ let check_func_type (c : context) (ft : func_type) at =

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

let check_table_type (c : context) (tt : table_type) at =
let TableT (lim, t) = tt in
Expand Down
23 changes: 23 additions & 0 deletions test/core/cont.wast
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,29 @@
(drop)))
"non-continuation type 0")

(assert_invalid
(module
(type $ct (cont $ct)))
"non-function type 0")

(assert_invalid
(module
(rec
(type $s0 (struct (field (ref 0) (ref 1) (ref $s0) (ref $s1))))
(type $s1 (struct (field (ref 0) (ref 1) (ref $s0) (ref $s1))))
)
(type $ct (cont $s0)))
"non-function type 0")

(module
(rec
(type $f1 (func (param (ref $f2))))
(type $f2 (func (param (ref $f1))))
)
(type $c1 (cont $f1))
(type $c2 (cont $f2))
)

;; Simple state example

(module $state
Expand Down

0 comments on commit dd4644e

Please sign in to comment.