diff --git a/interpreter/valid/valid.ml b/interpreter/valid/valid.ml index 9bb1459412..bb31ea8362 100644 --- a/interpreter/valid/valid.ml +++ b/interpreter/valid/valid.ml @@ -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 diff --git a/test/core/cont.wast b/test/core/cont.wast index c3ce4b18b8..784cf025cd 100644 --- a/test/core/cont.wast +++ b/test/core/cont.wast @@ -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