-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathimplements.wast
More file actions
78 lines (67 loc) · 2.1 KB
/
implements.wast
File metadata and controls
78 lines (67 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
;; RUN: wast --assert default --snapshot tests/snapshots %
;; Valid: basic [implements=<...>] on instance import
(component
(import "[implements=<a:b/c>]name" (instance))
)
;; Valid: [implements=<...>] on instance export
(component
(instance $i)
(export "[implements=<a:b/c>]name" (instance $i))
)
;; Valid: two imports with the same interface, different labels
(component
(import "[implements=<a:b/c>]one" (instance))
(import "[implements=<a:b/c>]two" (instance))
)
;; Valid: [implements=<...>] with version in interface name
(component
(import "[implements=<a:b/c@1.2.3>]name" (instance))
)
;; Valid: [implements=<...>] alongside a bare interface import of the same interface
(component
(import "a:b/c" (instance))
(import "[implements=<a:b/c>]alt" (instance))
)
;; Valid: in a component type
(component
(type (component
(import "[implements=<a:b/c>]one" (instance
(export "get" (func (param "key" string) (result (option string))))
))
(import "[implements=<a:b/c>]two" (instance
(export "get" (func (param "key" string) (result (option string))))
))
))
)
;; Invalid: [implements=<...>] on func (must be instance)
(assert_invalid
(component
(import "[implements=<a:b/c>]name" (func))
)
"`[implements=<a:b/c>]` must be on an instance import or export")
;; Invalid: [implements=<...>] on component (must be instance)
(assert_invalid
(component
(import "[implements=<a:b/c>]name" (component))
)
"`[implements=<a:b/c>]` must be on an instance import or export")
;; Invalid: duplicate labels after stripping annotation
(assert_invalid
(component
(import "[implements=<a:b/c>]name" (instance))
(import "[implements=<x:y/z>]name" (instance))
)
"conflicts with previous name")
;; Invalid: duplicate label between annotated and bare plain name
(assert_invalid
(component
(import "name" (func))
(import "[implements=<a:b/c>]name" (instance))
)
"conflicts with previous name")
;; Invalid: malformed interface name inside annotation
(assert_invalid
(component
(import "[implements=<NotValid>]name" (instance))
)
"not a valid extern name")