Skip to content

Commit e69cee1

Browse files
authored
[test] Add syntax and scoping tests for type rec (#1944)
1 parent b7554b6 commit e69cee1

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/core/type-rec.wast

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
;; Syntax and Scoping
2+
3+
(module
4+
(type (func (param (ref 0)) (result (ref 0))))
5+
(rec
6+
(type (func (param (ref 2))))
7+
(type (func (result (ref 1))))
8+
)
9+
10+
(rec)
11+
(rec (type (func)))
12+
(rec (type $t (func)))
13+
(rec (type $t1 (func)) (type (func)) (type $t2 (func)))
14+
(rec (type $g (func (param (ref $g)) (result (ref $g)))))
15+
(rec
16+
(type $h (func (param (ref $k))))
17+
(type $k (func (result (ref $h))))
18+
)
19+
)
20+
21+
(assert_invalid
22+
(module
23+
(type (func (param (ref 1))))
24+
(type (func))
25+
)
26+
"unknown type"
27+
)
28+
(assert_invalid
29+
(module
30+
(rec (type (func (param (ref 1)))))
31+
(rec (type (func)))
32+
)
33+
"unknown type"
34+
)
35+
36+
137
;; Static matching of recursive types
238

339
(module

0 commit comments

Comments
 (0)