package test:variants;
interface to-test {
roundtrip-option: func(a: option<f32>) -> option<u8>;
roundtrip-result: func(a: result<u32, f32>) -> result<f64, u8>;
enum e1 { a, b }
roundtrip-enum: func(a: e1) -> e1;
invert-bool: func(a: bool) -> bool;
variant c1 { a(s32), b(s64) }
variant c2 { a(s32), b(f32) }
variant c3 { a(s32), b(f64) }
variant c4 { a(s64), b(f32) }
variant c5 { a(s64), b(f64) }
variant c6 { a(f32), b(f64) }
type casts = tuple<c1, c2, c3, c4, c5, c6>;
variant-casts: func(a: casts) -> casts;
variant z1 { a(s32), b }
variant z2 { a(s64), b }
variant z3 { a(f32), b }
variant z4 { a(f64), b }
type zeros = tuple<z1, z2, z3, z4>;
variant-zeros: func(a: zeros) -> zeros;
type option-typedef = option<u32>;
type bool-typedef = bool;
type result-typedef = result<u32>;
variant-typedefs: func(a: option-typedef, b: bool-typedef, c: result-typedef);
enum my-errno { success, a, b }
variant-enums: func(a: bool, b: result, c: my-errno) -> tuple<bool, result, my-errno>;
}
world runner {
import to-test;
export run: func();
}
world test {
export to-test;
}