From 145ff38dd46583de39383412db9d1c3476da0844 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Wed, 2 Jul 2025 13:55:24 +0200 Subject: [PATCH] [test] Add syntax and scoping tests for type rec --- test/core/type-rec.wast | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/core/type-rec.wast b/test/core/type-rec.wast index 5c4ba589da..59189db071 100644 --- a/test/core/type-rec.wast +++ b/test/core/type-rec.wast @@ -1,3 +1,39 @@ +;; Syntax and Scoping + +(module + (type (func (param (ref 0)) (result (ref 0)))) + (rec + (type (func (param (ref 2)))) + (type (func (result (ref 1)))) + ) + + (rec) + (rec (type (func))) + (rec (type $t (func))) + (rec (type $t1 (func)) (type (func)) (type $t2 (func))) + (rec (type $g (func (param (ref $g)) (result (ref $g))))) + (rec + (type $h (func (param (ref $k)))) + (type $k (func (result (ref $h)))) + ) +) + +(assert_invalid + (module + (type (func (param (ref 1)))) + (type (func)) + ) + "unknown type" +) +(assert_invalid + (module + (rec (type (func (param (ref 1))))) + (rec (type (func))) + ) + "unknown type" +) + + ;; Static matching of recursive types (module