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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
package foo:foo;
interface variants {
enum e1 {
a,
}
e1-arg: func(x: e1);
e1-result: func() -> e1;
record empty {}
variant v1 {
a,
c(e1),
d(string),
e(empty),
f,
g(u32),
}
v1-arg: func(x: v1);
v1-result: func() -> v1;
bool-arg: func(x: bool);
bool-result: func() -> bool;
option-arg: func(
a: option<bool>,
b: option<tuple<>>,
c: option<u32>,
d: option<e1>,
e: option<f32>,
g: option<option<bool>>,
);
option-result: func() -> tuple<
option<bool>,
option<tuple<>>,
option<u32>,
option<e1>,
option<f32>,
option<option<bool>>,
>;
variant casts1 {
a(s32),
b(f32),
}
variant casts2 {
a(f64),
b(f32),
}
variant casts3 {
a(f64),
b(u64),
}
variant casts4 {
a(u32),
b(s64),
}
variant casts5 {
a(f32),
b(s64),
}
variant casts6 {
a(tuple<f32, u32>),
b(tuple<u32, u32>),
}
casts: func(
a: casts1,
b: casts2,
c: casts3,
d: casts4,
e: casts5,
f: casts6,
) -> tuple<
casts1,
casts2,
casts3,
casts4,
casts5,
casts6,
>;
result-arg: func(
a: result,
b: result<_, e1>,
c: result<e1>,
d: result<tuple<>, tuple<>>,
e: result<u32, v1>,
f: result<string, list<u8>>,
);
result-result: func() -> tuple<
result,
result<_, e1>,
result<e1>,
result<tuple<>, tuple<>>,
result<u32, v1>,
result<string, list<u8>>,
>;
enum my-errno {
bad1,
bad2,
}
return-result-sugar: func() -> result<s32, my-errno>;
return-result-sugar2: func() -> result<_, my-errno>;
return-result-sugar3: func() -> result<my-errno, my-errno>;
return-result-sugar4: func() -> result<tuple<s32, u32>, my-errno>;
return-option-sugar: func() -> option<s32>;
return-option-sugar2: func() -> option<my-errno>;
result-simple: func() -> result<u32, s32>;
record is-clone {
v1: v1,
}
is-clone-arg: func(a: is-clone);
is-clone-return: func() -> is-clone;
return-named-option: func() -> (a: option<u8>);
return-named-result: func() -> (a: result<u8, my-errno>);
}
world my-world {
import variants;
export variants;
}
|