feat: add a histrical wit-bindgen

This commit is contained in:
2023-01-01 00:25:48 +08:00
parent 01e8f5a959
commit aa50d63aec
419 changed files with 45283 additions and 1 deletions

View File

@@ -0,0 +1 @@
type mismatch for default interface function `a`: expected `[I32, I32] -> [I32]` but found `[] -> []`

View File

@@ -0,0 +1,3 @@
(module
(func (export "a") unreachable)
)

View File

@@ -0,0 +1 @@
module imports from an empty module name

View File

@@ -0,0 +1,3 @@
(module
(import "" "foo" (func))
)

View File

@@ -0,0 +1,4 @@
(component
(core module (;0;))
(core instance (;0;) (instantiate 0))
)

View File

@@ -0,0 +1 @@
type mismatch for function `a` from exported interface `foo`: expected `[I32, I32] -> [I32]` but found `[] -> []`

View File

@@ -0,0 +1,3 @@
(module
(func (export "foo#a") unreachable)
)

View File

@@ -0,0 +1,84 @@
(component
(type (;0;) (func))
(type (;1;) (func (param "a" s8) (param "b" s16) (param "c" s32) (param "d" s64) (result string)))
(type (;2;) (tuple s8 s16 s32 s64))
(type (;3;) (func (result 2)))
(type (;4;) (flags "a" "b" "c"))
(type (;5;) (func (param "x" 4)))
(type (;6;) (variant (case $c0 "a" unit) (case $c1 "b" string) (case $c2 "c" s64)))
(type (;7;) (func (param "x" string) (result 6)))
(type (;8;) (func (param "x" 6) (result string)))
(core module (;0;)
(type (;0;) (func (param i32 i32 i32 i32) (result i32)))
(type (;1;) (func))
(type (;2;) (func (param i32 i32 i32 i64) (result i32)))
(type (;3;) (func (result i32)))
(type (;4;) (func (param i32 i32) (result i32)))
(type (;5;) (func (param i32 i64 i32) (result i32)))
(type (;6;) (func (param i32)))
(func (;0;) (type 0) (param i32 i32 i32 i32) (result i32)
unreachable
)
(func (;1;) (type 1)
unreachable
)
(func (;2;) (type 2) (param i32 i32 i32 i64) (result i32)
unreachable
)
(func (;3;) (type 3) (result i32)
unreachable
)
(func (;4;) (type 1)
unreachable
)
(func (;5;) (type 4) (param i32 i32) (result i32)
unreachable
)
(func (;6;) (type 5) (param i32 i64 i32) (result i32)
unreachable
)
(func (;7;) (type 6) (param i32)
unreachable
)
(memory (;0;) 1)
(export "memory" (memory 0))
(export "canonical_abi_realloc" (func 0))
(export "a" (func 1))
(export "b" (func 2))
(export "c" (func 3))
(export "foo#a" (func 4))
(export "foo#b" (func 5))
(export "foo#c" (func 6))
(export "bar#a" (func 7))
)
(core instance (;0;) (instantiate 0))
(core alias export 0 "memory" (memory (;0;)))
(core alias export 0 "canonical_abi_realloc" (func (;0;)))
(core alias export 0 "a" (func (;1;)))
(core alias export 0 "b" (func (;2;)))
(core alias export 0 "c" (func (;3;)))
(func (;0;) (type 0) (canon lift (core func 1)))
(func (;1;) (type 1) (canon lift (core func 2) (memory 0) (realloc 0) string-encoding=utf8))
(func (;2;) (type 3) (canon lift (core func 3) (memory 0)))
(core alias export 0 "bar#a" (func (;4;)))
(func (;3;) (type 5) (canon lift (core func 4)))
(core alias export 0 "foo#a" (func (;5;)))
(core alias export 0 "foo#b" (func (;6;)))
(core alias export 0 "foo#c" (func (;7;)))
(func (;4;) (type 0) (canon lift (core func 5)))
(func (;5;) (type 7) (canon lift (core func 6) (memory 0) (realloc 0) string-encoding=utf8))
(func (;6;) (type 8) (canon lift (core func 7) (memory 0) (realloc 0) string-encoding=utf8))
(instance (;0;)
(export "a" (func 3))
)
(instance (;1;)
(export "a" (func 4))
(export "b" (func 5))
(export "c" (func 6))
)
(export "a" (func 0))
(export "b" (func 1))
(export "c" (func 2))
(export "bar" (instance 0))
(export "foo" (instance 1))
)

View File

@@ -0,0 +1,3 @@
a: func()
b: func(a: s8, b: s16, c: s32, d: s64) -> string
c: func() -> tuple<s8, s16, s32, s64>

View File

@@ -0,0 +1,7 @@
flags x {
a,
b,
c
}
a: func(x: x)

View File

@@ -0,0 +1,9 @@
variant x {
a,
b(string),
c(s64)
}
a: func()
b: func(x: string) -> x
c: func(x: x) -> string

View File

@@ -0,0 +1,11 @@
(module
(memory (export "memory") 1)
(func (export "canonical_abi_realloc") (param i32 i32 i32 i32) (result i32) unreachable)
(func (export "a") unreachable)
(func (export "b") (param i32 i32 i32 i64) (result i32) unreachable)
(func (export "c") (result i32) unreachable)
(func (export "foo#a") unreachable)
(func (export "foo#b") (param i32 i32) (result i32) unreachable)
(func (export "foo#c") (param i32 i64 i32) (result i32) unreachable)
(func (export "bar#a") (param i32) unreachable)
)

View File

@@ -0,0 +1,108 @@
(component
(type (;0;) (func (param "x" u64) (param "y" string)))
(type (;1;)
(instance
(alias outer 1 0 (type (;0;)))
(export "a" (func (type 0)))
)
)
(type (;2;) (list u8))
(type (;3;) (func (param "x" 2) (result 2)))
(type (;4;)
(instance
(alias outer 1 3 (type (;0;)))
(export "baz" (func (type 0)))
)
)
(type (;5;) (func))
(type (;6;)
(instance
(alias outer 1 5 (type (;0;)))
(export "a" (func (type 0)))
)
)
(import "bar" (instance (;0;) (type 1)))
(import "baz" (instance (;1;) (type 4)))
(import "foo" (instance (;2;) (type 6)))
(core module (;0;)
(type (;0;) (func))
(type (;1;) (func (param i64 i32 i32)))
(type (;2;) (func (param i32 i32 i32)))
(type (;3;) (func (param i32 i32 i32 i32) (result i32)))
(import "foo" "a" (func (;0;) (type 0)))
(import "bar" "a" (func (;1;) (type 1)))
(import "baz" "baz" (func (;2;) (type 2)))
(func (;3;) (type 3) (param i32 i32 i32 i32) (result i32)
unreachable
)
(memory (;0;) 1)
(export "memory" (memory 0))
(export "canonical_abi_realloc" (func 3))
)
(core module (;1;)
(type (;0;) (func (param i64 i32 i32)))
(type (;1;) (func (param i32 i32 i32)))
(func (;0;) (type 0) (param i64 i32 i32)
local.get 0
local.get 1
local.get 2
i32.const 0
call_indirect (type 0)
)
(func (;1;) (type 1) (param i32 i32 i32)
local.get 0
local.get 1
local.get 2
i32.const 1
call_indirect (type 1)
)
(table (;0;) 2 2 funcref)
(export "0" (func 0))
(export "1" (func 1))
(export "$imports" (table 0))
)
(core module (;2;)
(type (;0;) (func (param i64 i32 i32)))
(type (;1;) (func (param i32 i32 i32)))
(import "" "0" (func (;0;) (type 0)))
(import "" "1" (func (;1;) (type 1)))
(import "" "$imports" (table (;0;) 2 2 funcref))
(elem (;0;) (i32.const 0) func 0 1)
)
(core instance (;0;) (instantiate 1))
(core alias export 0 "0" (func (;0;)))
(core alias export 0 "1" (func (;1;)))
(alias export 2 "a" (func (;0;)))
(core func (;2;) (canon lower (func 0)))
(core instance (;1;)
(export "a" (func 0))
)
(core instance (;2;)
(export "baz" (func 1))
)
(core instance (;3;)
(export "a" (func 2))
)
(core instance (;4;) (instantiate 0
(with "bar" (instance 1))
(with "baz" (instance 2))
(with "foo" (instance 3))
)
)
(core alias export 4 "memory" (memory (;0;)))
(core alias export 4 "canonical_abi_realloc" (func (;3;)))
(core alias export 0 "$imports" (table (;0;)))
(alias export 0 "a" (func (;1;)))
(alias export 1 "baz" (func (;2;)))
(core func (;4;) (canon lower (func 1) (memory 0) (realloc 3) string-encoding=utf8))
(core func (;5;) (canon lower (func 2) (memory 0) (realloc 3)))
(core instance (;5;)
(export "$imports" (table 0))
(export "0" (func 4))
(export "1" (func 5))
)
(core instance (;6;) (instantiate 2
(with "" (instance 5))
)
)
)

View File

@@ -0,0 +1 @@
baz: func(x: list<u8>) -> list<u8>

View File

@@ -0,0 +1,7 @@
(module
(import "foo" "a" (func))
(import "bar" "a" (func (param i64 i32 i32)))
(import "baz" "baz" (func (param i32 i32 i32)))
(memory (export "memory") 1)
(func (export "canonical_abi_realloc") (param i32 i32 i32 i32) (result i32) unreachable)
)

View File

@@ -0,0 +1,90 @@
(component
(type (;0;) (func (result string)))
(type (;1;)
(instance
(alias outer 1 0 (type (;0;)))
(export "a" (func (type 0)))
)
)
(type (;2;) (tuple string u32 string))
(type (;3;) (func (param "x" string) (result 2)))
(type (;4;) (func))
(import "foo" (instance (;0;) (type 1)))
(core module (;0;)
(type (;0;) (func (param i32)))
(type (;1;) (func (param i32 i32 i32 i32) (result i32)))
(type (;2;) (func (param i32 i32) (result i32)))
(type (;3;) (func))
(type (;4;) (func (result i32)))
(import "foo" "a" (func (;0;) (type 0)))
(func (;1;) (type 1) (param i32 i32 i32 i32) (result i32)
unreachable
)
(func (;2;) (type 2) (param i32 i32) (result i32)
unreachable
)
(func (;3;) (type 3)
unreachable
)
(func (;4;) (type 4) (result i32)
unreachable
)
(memory (;0;) 1)
(export "memory" (memory 0))
(export "canonical_abi_realloc" (func 1))
(export "a" (func 2))
(export "bar#a" (func 3))
(export "bar#b" (func 4))
)
(core module (;1;)
(type (;0;) (func (param i32)))
(func (;0;) (type 0) (param i32)
local.get 0
i32.const 0
call_indirect (type 0)
)
(table (;0;) 1 1 funcref)
(export "0" (func 0))
(export "$imports" (table 0))
)
(core module (;2;)
(type (;0;) (func (param i32)))
(import "" "0" (func (;0;) (type 0)))
(import "" "$imports" (table (;0;) 1 1 funcref))
(elem (;0;) (i32.const 0) func 0)
)
(core instance (;0;) (instantiate 1))
(core alias export 0 "0" (func (;0;)))
(core instance (;1;)
(export "a" (func 0))
)
(core instance (;2;) (instantiate 0
(with "foo" (instance 1))
)
)
(core alias export 2 "memory" (memory (;0;)))
(core alias export 2 "canonical_abi_realloc" (func (;1;)))
(core alias export 0 "$imports" (table (;0;)))
(alias export 0 "a" (func (;0;)))
(core func (;2;) (canon lower (func 0) (memory 0) (realloc 1) string-encoding=utf8))
(core instance (;3;)
(export "$imports" (table 0))
(export "0" (func 2))
)
(core instance (;4;) (instantiate 2
(with "" (instance 3))
)
)
(core alias export 2 "a" (func (;3;)))
(func (;1;) (type 3) (canon lift (core func 3) (memory 0) (realloc 1) string-encoding=utf8))
(core alias export 2 "bar#a" (func (;4;)))
(core alias export 2 "bar#b" (func (;5;)))
(func (;2;) (type 4) (canon lift (core func 4)))
(func (;3;) (type 0) (canon lift (core func 5) (memory 0) (realloc 1) string-encoding=utf8))
(instance (;1;)
(export "a" (func 2))
(export "b" (func 3))
)
(export "a" (func 1))
(export "bar" (instance 1))
)

View File

@@ -0,0 +1 @@
a: func(x: string) -> tuple<string, u32, string>

View File

@@ -0,0 +1,2 @@
a: func()
b: func() -> string

View File

@@ -0,0 +1,8 @@
(module
(import "foo" "a" (func (param i32)))
(memory (export "memory") 1)
(func (export "canonical_abi_realloc") (param i32 i32 i32 i32) (result i32) unreachable)
(func (export "a") (param i32 i32) (result i32) unreachable)
(func (export "bar#a") unreachable)
(func (export "bar#b") (result i32) unreachable)
)

View File

@@ -0,0 +1 @@
type mismatch for function `bar` on imported interface `foo`: expected `[I32, I32] -> []` but found `[] -> []`

View File

@@ -0,0 +1,3 @@
(module
(import "foo" "bar" (func))
)

View File

@@ -0,0 +1,141 @@
(component
(type (;0;) (func (param "x" string)))
(type (;1;) (record (field "a" u8)))
(type (;2;) (func (param "x" 1)))
(type (;3;)
(instance
(alias outer 1 0 (type (;0;)))
(export "bar1" (func (type 0)))
(alias outer 1 2 (type (;1;)))
(export "bar2" (func (type 1)))
)
)
(type (;4;) (list string))
(type (;5;) (func (param "x" 4)))
(type (;6;) (func))
(type (;7;) s8)
(type (;8;) (func (param "x" 7)))
(type (;9;)
(instance
(alias outer 1 5 (type (;0;)))
(export "baz1" (func (type 0)))
(alias outer 1 6 (type (;1;)))
(export "baz2" (func (type 1)))
(alias outer 1 8 (type (;2;)))
(export "baz3" (func (type 2)))
)
)
(type (;10;) (func (param "x" u8)))
(type (;11;) (func (param "x" float32)))
(type (;12;)
(instance
(alias outer 1 6 (type (;0;)))
(export "foo1" (func (type 0)))
(alias outer 1 10 (type (;1;)))
(export "foo2" (func (type 1)))
(alias outer 1 11 (type (;2;)))
(export "foo3" (func (type 2)))
)
)
(import "bar" (instance (;0;) (type 3)))
(import "baz" (instance (;1;) (type 9)))
(import "foo" (instance (;2;) (type 12)))
(core module (;0;)
(type (;0;) (func))
(type (;1;) (func (param i32)))
(type (;2;) (func (param f32)))
(type (;3;) (func (param i32 i32)))
(type (;4;) (func (param i32 i32 i32 i32) (result i32)))
(import "foo" "foo1" (func (;0;) (type 0)))
(import "foo" "foo2" (func (;1;) (type 1)))
(import "foo" "foo3" (func (;2;) (type 2)))
(import "bar" "bar1" (func (;3;) (type 3)))
(import "bar" "bar2" (func (;4;) (type 1)))
(import "baz" "baz1" (func (;5;) (type 3)))
(import "baz" "baz2" (func (;6;) (type 0)))
(import "baz" "baz3" (func (;7;) (type 1)))
(func (;8;) (type 4) (param i32 i32 i32 i32) (result i32)
unreachable
)
(memory (;0;) 1)
(export "memory" (memory 0))
(export "canonical_abi_realloc" (func 8))
)
(core module (;1;)
(type (;0;) (func (param i32 i32)))
(func (;0;) (type 0) (param i32 i32)
local.get 0
local.get 1
i32.const 0
call_indirect (type 0)
)
(func (;1;) (type 0) (param i32 i32)
local.get 0
local.get 1
i32.const 1
call_indirect (type 0)
)
(table (;0;) 2 2 funcref)
(export "0" (func 0))
(export "1" (func 1))
(export "$imports" (table 0))
)
(core module (;2;)
(type (;0;) (func (param i32 i32)))
(import "" "0" (func (;0;) (type 0)))
(import "" "1" (func (;1;) (type 0)))
(import "" "$imports" (table (;0;) 2 2 funcref))
(elem (;0;) (i32.const 0) func 0 1)
)
(core instance (;0;) (instantiate 1))
(core alias export 0 "0" (func (;0;)))
(alias export 0 "bar2" (func (;0;)))
(core func (;1;) (canon lower (func 0)))
(core alias export 0 "1" (func (;2;)))
(alias export 1 "baz2" (func (;1;)))
(alias export 1 "baz3" (func (;2;)))
(core func (;3;) (canon lower (func 1)))
(core func (;4;) (canon lower (func 2)))
(alias export 2 "foo1" (func (;3;)))
(alias export 2 "foo2" (func (;4;)))
(alias export 2 "foo3" (func (;5;)))
(core func (;5;) (canon lower (func 3)))
(core func (;6;) (canon lower (func 4)))
(core func (;7;) (canon lower (func 5)))
(core instance (;1;)
(export "bar1" (func 0))
(export "bar2" (func 1))
)
(core instance (;2;)
(export "baz1" (func 2))
(export "baz2" (func 3))
(export "baz3" (func 4))
)
(core instance (;3;)
(export "foo1" (func 5))
(export "foo2" (func 6))
(export "foo3" (func 7))
)
(core instance (;4;) (instantiate 0
(with "bar" (instance 1))
(with "baz" (instance 2))
(with "foo" (instance 3))
)
)
(core alias export 4 "memory" (memory (;0;)))
(core alias export 4 "canonical_abi_realloc" (func (;8;)))
(core alias export 0 "$imports" (table (;0;)))
(alias export 0 "bar1" (func (;6;)))
(alias export 1 "baz1" (func (;7;)))
(core func (;9;) (canon lower (func 6) (memory 0) (realloc 8) string-encoding=utf8))
(core func (;10;) (canon lower (func 7) (memory 0) (realloc 8) string-encoding=utf8))
(core instance (;5;)
(export "$imports" (table 0))
(export "0" (func 9))
(export "1" (func 10))
)
(core instance (;6;) (instantiate 2
(with "" (instance 5))
)
)
)

View File

@@ -0,0 +1,6 @@
record x {
a: u8
}
bar1: func(x: string)
bar2: func(x: x)

View File

@@ -0,0 +1,5 @@
type x = s8
baz1: func(x: list<string>)
baz2: func()
baz3: func(x: x)

View File

@@ -0,0 +1,3 @@
foo1: func()
foo2: func(x: u8)
foo3: func(x: float32)

View File

@@ -0,0 +1,12 @@
(module
(import "foo" "foo1" (func))
(import "foo" "foo2" (func (param i32)))
(import "foo" "foo3" (func (param f32)))
(import "bar" "bar1" (func (param i32 i32)))
(import "bar" "bar2" (func (param i32)))
(import "baz" "baz1" (func (param i32 i32)))
(import "baz" "baz2" (func))
(import "baz" "baz3" (func (param i32)))
(memory (export "memory") 1)
(func (export "canonical_abi_realloc") (param i32 i32 i32 i32) (result i32) unreachable)
)

View File

@@ -0,0 +1 @@
module is only allowed to import functions

View File

@@ -0,0 +1,3 @@
(module
(import "" "" (table 1 funcref))
)

View File

@@ -0,0 +1,161 @@
(component
(type (;0;) (func))
(type (;1;) (list string))
(type (;2;) (func (param "x" 1)))
(type (;3;) (record (field "s" string)))
(type (;4;) (func (param "x" 3)))
(type (;5;) (variant (case $c0 "s" string)))
(type (;6;) (func (param "x" 5)))
(type (;7;) (record (field "s" u32)))
(type (;8;) (func (param "x" 7)))
(type (;9;) (variant (case $c0 "s" u32)))
(type (;10;) (func (param "x" 9)))
(type (;11;) (list 3))
(type (;12;) (func (param "x" 11)))
(type (;13;) (list 5))
(type (;14;) (func (param "x" 13)))
(type (;15;) (list u32))
(type (;16;) (func (param "x" 15)))
(type (;17;) (func (param "x" u32)))
(type (;18;) (tuple u32 u32))
(type (;19;) (func (result 18)))
(type (;20;) (func (result string)))
(type (;21;) (func (result 15)))
(type (;22;) (func (result u32)))
(type (;23;) (func (result 5)))
(type (;24;) (list 9))
(type (;25;) (func (result 24)))
(export "r" (type 3))
(export "v" (type 5))
(export "r-no-string" (type 7))
(export "v-no-string" (type 9))
(core module (;0;)
(type (;0;) (func (param i32 i32 i32 i32) (result i32)))
(type (;1;) (func))
(type (;2;) (func (param i32 i32)))
(type (;3;) (func (param i32 i32 i32)))
(type (;4;) (func (param i32)))
(type (;5;) (func (result i32)))
(func (;0;) (type 0) (param i32 i32 i32 i32) (result i32)
unreachable
)
(func (;1;) (type 1)
unreachable
)
(func (;2;) (type 2) (param i32 i32)
unreachable
)
(func (;3;) (type 2) (param i32 i32)
unreachable
)
(func (;4;) (type 3) (param i32 i32 i32)
unreachable
)
(func (;5;) (type 4) (param i32)
unreachable
)
(func (;6;) (type 2) (param i32 i32)
unreachable
)
(func (;7;) (type 2) (param i32 i32)
unreachable
)
(func (;8;) (type 2) (param i32 i32)
unreachable
)
(func (;9;) (type 2) (param i32 i32)
unreachable
)
(func (;10;) (type 4) (param i32)
unreachable
)
(func (;11;) (type 5) (result i32)
unreachable
)
(func (;12;) (type 5) (result i32)
unreachable
)
(func (;13;) (type 5) (result i32)
unreachable
)
(func (;14;) (type 5) (result i32)
unreachable
)
(func (;15;) (type 5) (result i32)
unreachable
)
(func (;16;) (type 5) (result i32)
unreachable
)
(memory (;0;) 1)
(export "memory" (memory 0))
(export "canonical_abi_realloc" (func 0))
(export "a" (func 1))
(export "b" (func 2))
(export "c" (func 3))
(export "d" (func 4))
(export "e" (func 5))
(export "f" (func 6))
(export "g" (func 7))
(export "h" (func 8))
(export "i" (func 9))
(export "j" (func 10))
(export "k" (func 11))
(export "l" (func 12))
(export "m" (func 13))
(export "n" (func 14))
(export "o" (func 15))
(export "p" (func 16))
)
(core instance (;0;) (instantiate 0))
(core alias export 0 "memory" (memory (;0;)))
(core alias export 0 "canonical_abi_realloc" (func (;0;)))
(core alias export 0 "a" (func (;1;)))
(core alias export 0 "b" (func (;2;)))
(core alias export 0 "c" (func (;3;)))
(core alias export 0 "d" (func (;4;)))
(core alias export 0 "e" (func (;5;)))
(core alias export 0 "f" (func (;6;)))
(core alias export 0 "g" (func (;7;)))
(core alias export 0 "h" (func (;8;)))
(core alias export 0 "i" (func (;9;)))
(core alias export 0 "j" (func (;10;)))
(core alias export 0 "k" (func (;11;)))
(core alias export 0 "l" (func (;12;)))
(core alias export 0 "m" (func (;13;)))
(core alias export 0 "n" (func (;14;)))
(core alias export 0 "o" (func (;15;)))
(core alias export 0 "p" (func (;16;)))
(func (;0;) (type 0) (canon lift (core func 1)))
(func (;1;) (type 2) (canon lift (core func 2) (memory 0) (realloc 0) string-encoding=utf8))
(func (;2;) (type 4) (canon lift (core func 3) (memory 0) (realloc 0) string-encoding=utf8))
(func (;3;) (type 6) (canon lift (core func 4) (memory 0) (realloc 0) string-encoding=utf8))
(func (;4;) (type 8) (canon lift (core func 5)))
(func (;5;) (type 10) (canon lift (core func 6)))
(func (;6;) (type 12) (canon lift (core func 7) (memory 0) (realloc 0) string-encoding=utf8))
(func (;7;) (type 14) (canon lift (core func 8) (memory 0) (realloc 0) string-encoding=utf8))
(func (;8;) (type 16) (canon lift (core func 9) (memory 0) (realloc 0)))
(func (;9;) (type 17) (canon lift (core func 10)))
(func (;10;) (type 19) (canon lift (core func 11) (memory 0)))
(func (;11;) (type 20) (canon lift (core func 12) (memory 0) (realloc 0) string-encoding=utf8))
(func (;12;) (type 21) (canon lift (core func 13) (memory 0) (realloc 0)))
(func (;13;) (type 22) (canon lift (core func 14)))
(func (;14;) (type 23) (canon lift (core func 15) (memory 0) (realloc 0) string-encoding=utf8))
(func (;15;) (type 25) (canon lift (core func 16) (memory 0) (realloc 0)))
(export "a" (func 0))
(export "b" (func 1))
(export "c" (func 2))
(export "d" (func 3))
(export "e" (func 4))
(export "f" (func 5))
(export "g" (func 6))
(export "h" (func 7))
(export "i" (func 8))
(export "j" (func 9))
(export "k" (func 10))
(export "l" (func 11))
(export "m" (func 12))
(export "n" (func 13))
(export "o" (func 14))
(export "p" (func 15))
)

View File

@@ -0,0 +1,32 @@
record r {
s: string
}
record r-no-string {
s: u32
}
variant v {
s(string)
}
variant v-no-string {
s(u32)
}
a: func()
b: func(x: list<string>)
c: func(x: r)
d: func(x: v)
e: func(x: r-no-string)
f: func(x: v-no-string)
g: func(x: list<r>)
h: func(x: list<v>)
i: func(x: list<u32>)
j: func(x: u32)
k: func() -> tuple<u32, u32>
l: func() -> string
m: func() -> list<u32>
n: func() -> u32
o: func() -> v
p: func() -> list<v-no-string>

View File

@@ -0,0 +1,20 @@
(module
(memory (export "memory") 1)
(func (export "canonical_abi_realloc") (param i32 i32 i32 i32) (result i32) unreachable)
(func (export "a") unreachable)
(func (export "b") (param i32 i32) unreachable)
(func (export "c") (param i32 i32) unreachable)
(func (export "d") (param i32 i32 i32) unreachable)
(func (export "e") (param i32) unreachable)
(func (export "f") (param i32 i32) unreachable)
(func (export "g") (param i32 i32) unreachable)
(func (export "h") (param i32 i32) unreachable)
(func (export "i") (param i32 i32) unreachable)
(func (export "j") (param i32) unreachable)
(func (export "k") (result i32) unreachable)
(func (export "l") (result i32) unreachable)
(func (export "m") (result i32) unreachable)
(func (export "n") (result i32) unreachable)
(func (export "o") (result i32) unreachable)
(func (export "p") (result i32) unreachable)
)

View File

@@ -0,0 +1,280 @@
(component
(type (;0;) (func))
(type (;1;) (list string))
(type (;2;) (func (param "x" 1)))
(type (;3;) (record (field "s" string)))
(type (;4;) (func (param "x" 3)))
(type (;5;) (variant (case $c0 "s" string)))
(type (;6;) (func (param "x" 5)))
(type (;7;) (record (field "s" u32)))
(type (;8;) (func (param "x" 7)))
(type (;9;) (variant (case $c0 "s" u32)))
(type (;10;) (func (param "x" 9)))
(type (;11;) (list 3))
(type (;12;) (func (param "x" 11)))
(type (;13;) (list 5))
(type (;14;) (func (param "x" 13)))
(type (;15;) (list u32))
(type (;16;) (func (param "x" 15)))
(type (;17;) (func (param "x" u32)))
(type (;18;) (tuple u32 u32))
(type (;19;) (func (result 18)))
(type (;20;) (func (result string)))
(type (;21;) (func (result 15)))
(type (;22;) (func (result u32)))
(type (;23;) (func (result 5)))
(type (;24;) (list 9))
(type (;25;) (func (result 24)))
(type (;26;)
(instance
(alias outer 1 0 (type (;0;)))
(export "a" (func (type 0)))
(alias outer 1 2 (type (;1;)))
(export "b" (func (type 1)))
(alias outer 1 4 (type (;2;)))
(export "c" (func (type 2)))
(alias outer 1 6 (type (;3;)))
(export "d" (func (type 3)))
(alias outer 1 8 (type (;4;)))
(export "e" (func (type 4)))
(alias outer 1 10 (type (;5;)))
(export "f" (func (type 5)))
(alias outer 1 12 (type (;6;)))
(export "g" (func (type 6)))
(alias outer 1 14 (type (;7;)))
(export "h" (func (type 7)))
(alias outer 1 16 (type (;8;)))
(export "i" (func (type 8)))
(alias outer 1 17 (type (;9;)))
(export "j" (func (type 9)))
(alias outer 1 19 (type (;10;)))
(export "k" (func (type 10)))
(alias outer 1 20 (type (;11;)))
(export "l" (func (type 11)))
(alias outer 1 21 (type (;12;)))
(export "m" (func (type 12)))
(alias outer 1 22 (type (;13;)))
(export "n" (func (type 13)))
(alias outer 1 23 (type (;14;)))
(export "o" (func (type 14)))
(alias outer 1 25 (type (;15;)))
(export "p" (func (type 15)))
)
)
(import "foo" (instance (;0;) (type 26)))
(core module (;0;)
(type (;0;) (func))
(type (;1;) (func (param i32 i32)))
(type (;2;) (func (param i32 i32 i32)))
(type (;3;) (func (param i32)))
(type (;4;) (func (result i32)))
(type (;5;) (func (param i32 i32 i32 i32) (result i32)))
(import "foo" "a" (func (;0;) (type 0)))
(import "foo" "b" (func (;1;) (type 1)))
(import "foo" "c" (func (;2;) (type 1)))
(import "foo" "d" (func (;3;) (type 2)))
(import "foo" "e" (func (;4;) (type 3)))
(import "foo" "f" (func (;5;) (type 1)))
(import "foo" "g" (func (;6;) (type 1)))
(import "foo" "h" (func (;7;) (type 1)))
(import "foo" "i" (func (;8;) (type 1)))
(import "foo" "j" (func (;9;) (type 3)))
(import "foo" "k" (func (;10;) (type 3)))
(import "foo" "l" (func (;11;) (type 3)))
(import "foo" "m" (func (;12;) (type 3)))
(import "foo" "n" (func (;13;) (type 4)))
(import "foo" "o" (func (;14;) (type 3)))
(import "foo" "p" (func (;15;) (type 3)))
(func (;16;) (type 5) (param i32 i32 i32 i32) (result i32)
unreachable
)
(memory (;0;) 1)
(export "memory" (memory 0))
(export "canonical_abi_realloc" (func 16))
)
(core module (;1;)
(type (;0;) (func (param i32 i32)))
(type (;1;) (func (param i32 i32 i32)))
(type (;2;) (func (param i32)))
(func (;0;) (type 0) (param i32 i32)
local.get 0
local.get 1
i32.const 0
call_indirect (type 0)
)
(func (;1;) (type 0) (param i32 i32)
local.get 0
local.get 1
i32.const 1
call_indirect (type 0)
)
(func (;2;) (type 1) (param i32 i32 i32)
local.get 0
local.get 1
local.get 2
i32.const 2
call_indirect (type 1)
)
(func (;3;) (type 0) (param i32 i32)
local.get 0
local.get 1
i32.const 3
call_indirect (type 0)
)
(func (;4;) (type 0) (param i32 i32)
local.get 0
local.get 1
i32.const 4
call_indirect (type 0)
)
(func (;5;) (type 0) (param i32 i32)
local.get 0
local.get 1
i32.const 5
call_indirect (type 0)
)
(func (;6;) (type 2) (param i32)
local.get 0
i32.const 6
call_indirect (type 2)
)
(func (;7;) (type 2) (param i32)
local.get 0
i32.const 7
call_indirect (type 2)
)
(func (;8;) (type 2) (param i32)
local.get 0
i32.const 8
call_indirect (type 2)
)
(func (;9;) (type 2) (param i32)
local.get 0
i32.const 9
call_indirect (type 2)
)
(func (;10;) (type 2) (param i32)
local.get 0
i32.const 10
call_indirect (type 2)
)
(table (;0;) 11 11 funcref)
(export "0" (func 0))
(export "1" (func 1))
(export "2" (func 2))
(export "3" (func 3))
(export "4" (func 4))
(export "5" (func 5))
(export "6" (func 6))
(export "7" (func 7))
(export "8" (func 8))
(export "9" (func 9))
(export "10" (func 10))
(export "$imports" (table 0))
)
(core module (;2;)
(type (;0;) (func (param i32 i32)))
(type (;1;) (func (param i32 i32 i32)))
(type (;2;) (func (param i32)))
(import "" "0" (func (;0;) (type 0)))
(import "" "1" (func (;1;) (type 0)))
(import "" "2" (func (;2;) (type 1)))
(import "" "3" (func (;3;) (type 0)))
(import "" "4" (func (;4;) (type 0)))
(import "" "5" (func (;5;) (type 0)))
(import "" "6" (func (;6;) (type 2)))
(import "" "7" (func (;7;) (type 2)))
(import "" "8" (func (;8;) (type 2)))
(import "" "9" (func (;9;) (type 2)))
(import "" "10" (func (;10;) (type 2)))
(import "" "$imports" (table (;0;) 11 11 funcref))
(elem (;0;) (i32.const 0) func 0 1 2 3 4 5 6 7 8 9 10)
)
(core instance (;0;) (instantiate 1))
(core alias export 0 "0" (func (;0;)))
(core alias export 0 "1" (func (;1;)))
(core alias export 0 "2" (func (;2;)))
(core alias export 0 "3" (func (;3;)))
(core alias export 0 "4" (func (;4;)))
(core alias export 0 "5" (func (;5;)))
(core alias export 0 "6" (func (;6;)))
(core alias export 0 "7" (func (;7;)))
(core alias export 0 "8" (func (;8;)))
(core alias export 0 "9" (func (;9;)))
(core alias export 0 "10" (func (;10;)))
(alias export 0 "a" (func (;0;)))
(alias export 0 "e" (func (;1;)))
(alias export 0 "f" (func (;2;)))
(alias export 0 "j" (func (;3;)))
(alias export 0 "n" (func (;4;)))
(core func (;11;) (canon lower (func 0)))
(core func (;12;) (canon lower (func 1)))
(core func (;13;) (canon lower (func 2)))
(core func (;14;) (canon lower (func 3)))
(core func (;15;) (canon lower (func 4)))
(core instance (;1;)
(export "b" (func 0))
(export "c" (func 1))
(export "d" (func 2))
(export "g" (func 3))
(export "h" (func 4))
(export "i" (func 5))
(export "k" (func 6))
(export "l" (func 7))
(export "m" (func 8))
(export "o" (func 9))
(export "p" (func 10))
(export "a" (func 11))
(export "e" (func 12))
(export "f" (func 13))
(export "j" (func 14))
(export "n" (func 15))
)
(core instance (;2;) (instantiate 0
(with "foo" (instance 1))
)
)
(core alias export 2 "memory" (memory (;0;)))
(core alias export 2 "canonical_abi_realloc" (func (;16;)))
(core alias export 0 "$imports" (table (;0;)))
(alias export 0 "b" (func (;5;)))
(alias export 0 "c" (func (;6;)))
(alias export 0 "d" (func (;7;)))
(alias export 0 "g" (func (;8;)))
(alias export 0 "h" (func (;9;)))
(alias export 0 "i" (func (;10;)))
(alias export 0 "k" (func (;11;)))
(alias export 0 "l" (func (;12;)))
(alias export 0 "m" (func (;13;)))
(alias export 0 "o" (func (;14;)))
(alias export 0 "p" (func (;15;)))
(core func (;17;) (canon lower (func 5) (memory 0) (realloc 16) string-encoding=utf8))
(core func (;18;) (canon lower (func 6) (memory 0) (realloc 16) string-encoding=utf8))
(core func (;19;) (canon lower (func 7) (memory 0) (realloc 16) string-encoding=utf8))
(core func (;20;) (canon lower (func 8) (memory 0) (realloc 16) string-encoding=utf8))
(core func (;21;) (canon lower (func 9) (memory 0) (realloc 16) string-encoding=utf8))
(core func (;22;) (canon lower (func 10) (memory 0) (realloc 16)))
(core func (;23;) (canon lower (func 11) (memory 0)))
(core func (;24;) (canon lower (func 12) (memory 0) (realloc 16) string-encoding=utf8))
(core func (;25;) (canon lower (func 13) (memory 0) (realloc 16)))
(core func (;26;) (canon lower (func 14) (memory 0) (realloc 16) string-encoding=utf8))
(core func (;27;) (canon lower (func 15) (memory 0) (realloc 16)))
(core instance (;3;)
(export "$imports" (table 0))
(export "0" (func 17))
(export "1" (func 18))
(export "2" (func 19))
(export "3" (func 20))
(export "4" (func 21))
(export "5" (func 22))
(export "6" (func 23))
(export "7" (func 24))
(export "8" (func 25))
(export "9" (func 26))
(export "10" (func 27))
)
(core instance (;4;) (instantiate 2
(with "" (instance 3))
)
)
)

View File

@@ -0,0 +1,32 @@
record r {
s: string
}
record r-no-string {
s: u32
}
variant v {
s(string)
}
variant v-no-string {
s(u32)
}
a: func()
b: func(x: list<string>)
c: func(x: r)
d: func(x: v)
e: func(x: r-no-string)
f: func(x: v-no-string)
g: func(x: list<r>)
h: func(x: list<v>)
i: func(x: list<u32>)
j: func(x: u32)
k: func() -> tuple<u32, u32>
l: func() -> string
m: func() -> list<u32>
n: func() -> u32
o: func() -> v
p: func() -> list<v-no-string>

View File

@@ -0,0 +1,20 @@
(module
(import "foo" "a" (func))
(import "foo" "b" (func (param i32 i32)))
(import "foo" "c" (func (param i32 i32)))
(import "foo" "d" (func (param i32 i32 i32)))
(import "foo" "e" (func (param i32)))
(import "foo" "f" (func (param i32 i32)))
(import "foo" "g" (func (param i32 i32)))
(import "foo" "h" (func (param i32 i32)))
(import "foo" "i" (func (param i32 i32)))
(import "foo" "j" (func (param i32)))
(import "foo" "k" (func (param i32)))
(import "foo" "l" (func (param i32)))
(import "foo" "m" (func (param i32)))
(import "foo" "n" (func (result i32)))
(import "foo" "o" (func (param i32)))
(import "foo" "p" (func (param i32)))
(memory (export "memory") 1)
(func (export "canonical_abi_realloc") (param i32 i32 i32 i32) (result i32) unreachable)
)

View File

@@ -0,0 +1 @@
module does not export required function `a`

View File

@@ -0,0 +1 @@
module does not export required function `foo#a`

View File

@@ -0,0 +1 @@
import interface `foo` is missing function `bar` that is required by the module

View File

@@ -0,0 +1,3 @@
(module
(import "foo" "bar" (func))
)

View File

@@ -0,0 +1 @@
module requires an import interface named `foo`

View File

@@ -0,0 +1,3 @@
(module
(import "foo" "bar" (func))
)

View File

@@ -0,0 +1,52 @@
(component
(type (;0;) (func))
(type (;1;) (func (result string)))
(type (;2;) (func (param "x" string) (result string)))
(type (;3;) (list string))
(type (;4;) (func (param "x" 3)))
(export "x" (type 3))
(core module (;0;)
(type (;0;) (func (param i32 i32 i32 i32) (result i32)))
(type (;1;) (func))
(type (;2;) (func (result i32)))
(type (;3;) (func (param i32 i32) (result i32)))
(type (;4;) (func (param i32 i32)))
(func $canonical_abi_realloc (;0;) (type 0) (param i32 i32 i32 i32) (result i32)
unreachable
)
(func $a (;1;) (type 1)
unreachable
)
(func $b (;2;) (type 2) (result i32)
unreachable
)
(func $c (;3;) (type 3) (param i32 i32) (result i32)
unreachable
)
(func $d (;4;) (type 4) (param i32 i32)
unreachable
)
(memory $memory (;0;) 1)
(export "memory" (memory $memory))
(export "canonical_abi_realloc" (func $canonical_abi_realloc))
(export "a" (func $a))
(export "b" (func $b))
(export "c" (func $c))
(export "d" (func $d))
)
(core instance (;0;) (instantiate 0))
(core alias export 0 "memory" (memory (;0;)))
(core alias export 0 "canonical_abi_realloc" (func (;0;)))
(core alias export 0 "a" (func (;1;)))
(core alias export 0 "b" (func (;2;)))
(core alias export 0 "c" (func (;3;)))
(core alias export 0 "d" (func (;4;)))
(func (;0;) (type 0) (canon lift (core func 1)))
(func (;1;) (type 1) (canon lift (core func 2) (memory 0) (realloc 0) string-encoding=utf8))
(func (;2;) (type 2) (canon lift (core func 3) (memory 0) (realloc 0) string-encoding=utf8))
(func (;3;) (type 4) (canon lift (core func 4) (memory 0) (realloc 0) string-encoding=utf8))
(export "a" (func 0))
(export "b" (func 1))
(export "c" (func 2))
(export "d" (func 3))
)

View File

@@ -0,0 +1,6 @@
type x = list<string>
a: func()
b: func() -> string
c: func(x: string) -> string
d: func(x: x)

View File

@@ -0,0 +1,8 @@
(module
(memory $memory (export "memory") 1)
(func $canonical_abi_realloc (export "canonical_abi_realloc") (param i32 i32 i32 i32) (result i32) unreachable)
(func $a (export "a") unreachable)
(func $b (export "b") (result i32) unreachable)
(func $c (export "c") (param i32 i32) (result i32) unreachable)
(func $d (export "d") (param i32 i32) unreachable)
)