From 0093476a2c89f97e2eb467a184b44634f0123c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hillerstr=C3=B6m?= Date: Thu, 25 Jan 2024 11:24:55 +0100 Subject: [PATCH] Resolve #17 This patch (re)installs the check for continuation type well-formedness. Currently, it allows only continuation types to be indexed by plain function types. --- interpreter/valid/valid.ml | 4 +++- test/core/cont.wast | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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..6649917fe1 100644 --- a/test/core/cont.wast +++ b/test/core/cont.wast @@ -205,6 +205,11 @@ (drop))) "non-continuation type 0") +(assert_invalid + (module + (type $ct (cont $ct))) + "non-function type 0") + ;; Simple state example (module $state