From 49916909ac3293664a8fab1af80d215c9488d62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hillerstr=C3=B6m?= Date: Thu, 1 Aug 2024 11:52:21 +0200 Subject: [PATCH] Fix global.set too --- interpreter/runtime/global.ml | 1 - test/core/cont.wast | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/interpreter/runtime/global.ml b/interpreter/runtime/global.ml index 3640cf404b..cf69d2ac19 100644 --- a/interpreter/runtime/global.ml +++ b/interpreter/runtime/global.ml @@ -21,5 +21,4 @@ let load glob = let store glob v = let GlobalT (mut, t) = glob.ty in if mut <> Var then raise NotMutable; - if not (Match.match_val_type [] (type_of_value v) t) then raise Type; glob.content <- v diff --git a/test/core/cont.wast b/test/core/cont.wast index 8c6ac796d0..2752a71b6b 100644 --- a/test/core/cont.wast +++ b/test/core/cont.wast @@ -663,6 +663,10 @@ (global $k (mut (ref null $ct)) (ref.null $ct)) (global $g (ref null $ct) (ref.null $ct)) - (func (param $c (ref $ct)) - (global.set $k (local.get $c))) -) \ No newline at end of file + (func $f) + (elem declare func $f) + + (func (export "set-global") + (global.set $k (cont.new $ct (ref.func $f)))) +) +(assert_return (invoke "set-global")) \ No newline at end of file