1fd3a827eSAlex Crichtonpackage foo:foo; 241417d9eSAlex Crichton 32329ecc3SAlex Crichtoninterface variants { 42329ecc3SAlex Crichton enum e1 { 52329ecc3SAlex Crichton a, 62329ecc3SAlex Crichton } 72329ecc3SAlex Crichton 8fd3a827eSAlex Crichton e1-arg: func(x: e1); 9fd3a827eSAlex Crichton e1-result: func() -> e1; 102329ecc3SAlex Crichton 112329ecc3SAlex Crichton record empty {} 122329ecc3SAlex Crichton 132329ecc3SAlex Crichton variant v1 { 142329ecc3SAlex Crichton a, 152329ecc3SAlex Crichton c(e1), 162329ecc3SAlex Crichton d(string), 172329ecc3SAlex Crichton e(empty), 182329ecc3SAlex Crichton f, 192329ecc3SAlex Crichton g(u32), 202329ecc3SAlex Crichton } 212329ecc3SAlex Crichton 22fd3a827eSAlex Crichton v1-arg: func(x: v1); 23fd3a827eSAlex Crichton v1-result: func() -> v1; 242329ecc3SAlex Crichton 25fd3a827eSAlex Crichton bool-arg: func(x: bool); 26fd3a827eSAlex Crichton bool-result: func() -> bool; 272329ecc3SAlex Crichton 282329ecc3SAlex Crichton option-arg: func( 292329ecc3SAlex Crichton a: option<bool>, 302329ecc3SAlex Crichton b: option<tuple<>>, 312329ecc3SAlex Crichton c: option<u32>, 322329ecc3SAlex Crichton d: option<e1>, 33*6844ed1aSAlex Crichton e: option<f32>, 342329ecc3SAlex Crichton g: option<option<bool>>, 35fd3a827eSAlex Crichton ); 362329ecc3SAlex Crichton option-result: func() -> tuple< 372329ecc3SAlex Crichton option<bool>, 382329ecc3SAlex Crichton option<tuple<>>, 392329ecc3SAlex Crichton option<u32>, 402329ecc3SAlex Crichton option<e1>, 41*6844ed1aSAlex Crichton option<f32>, 422329ecc3SAlex Crichton option<option<bool>>, 43fd3a827eSAlex Crichton >; 442329ecc3SAlex Crichton 452329ecc3SAlex Crichton variant casts1 { 462329ecc3SAlex Crichton a(s32), 47*6844ed1aSAlex Crichton b(f32), 482329ecc3SAlex Crichton } 492329ecc3SAlex Crichton 502329ecc3SAlex Crichton variant casts2 { 51*6844ed1aSAlex Crichton a(f64), 52*6844ed1aSAlex Crichton b(f32), 532329ecc3SAlex Crichton } 542329ecc3SAlex Crichton 552329ecc3SAlex Crichton variant casts3 { 56*6844ed1aSAlex Crichton a(f64), 572329ecc3SAlex Crichton b(u64), 582329ecc3SAlex Crichton } 592329ecc3SAlex Crichton 602329ecc3SAlex Crichton variant casts4 { 612329ecc3SAlex Crichton a(u32), 622329ecc3SAlex Crichton b(s64), 632329ecc3SAlex Crichton } 642329ecc3SAlex Crichton 652329ecc3SAlex Crichton variant casts5 { 66*6844ed1aSAlex Crichton a(f32), 672329ecc3SAlex Crichton b(s64), 682329ecc3SAlex Crichton } 692329ecc3SAlex Crichton 702329ecc3SAlex Crichton variant casts6 { 71*6844ed1aSAlex Crichton a(tuple<f32, u32>), 722329ecc3SAlex Crichton b(tuple<u32, u32>), 732329ecc3SAlex Crichton } 742329ecc3SAlex Crichton 752329ecc3SAlex Crichton casts: func( 762329ecc3SAlex Crichton a: casts1, 772329ecc3SAlex Crichton b: casts2, 782329ecc3SAlex Crichton c: casts3, 792329ecc3SAlex Crichton d: casts4, 802329ecc3SAlex Crichton e: casts5, 812329ecc3SAlex Crichton f: casts6, 822329ecc3SAlex Crichton ) -> tuple< 832329ecc3SAlex Crichton casts1, 842329ecc3SAlex Crichton casts2, 852329ecc3SAlex Crichton casts3, 862329ecc3SAlex Crichton casts4, 872329ecc3SAlex Crichton casts5, 882329ecc3SAlex Crichton casts6, 89fd3a827eSAlex Crichton >; 902329ecc3SAlex Crichton 912329ecc3SAlex Crichton result-arg: func( 922329ecc3SAlex Crichton a: result, 932329ecc3SAlex Crichton b: result<_, e1>, 942329ecc3SAlex Crichton c: result<e1>, 952329ecc3SAlex Crichton d: result<tuple<>, tuple<>>, 962329ecc3SAlex Crichton e: result<u32, v1>, 972329ecc3SAlex Crichton f: result<string, list<u8>>, 98fd3a827eSAlex Crichton ); 992329ecc3SAlex Crichton result-result: func() -> tuple< 1002329ecc3SAlex Crichton result, 1012329ecc3SAlex Crichton result<_, e1>, 1022329ecc3SAlex Crichton result<e1>, 1032329ecc3SAlex Crichton result<tuple<>, tuple<>>, 1042329ecc3SAlex Crichton result<u32, v1>, 1052329ecc3SAlex Crichton result<string, list<u8>>, 106fd3a827eSAlex Crichton >; 1072329ecc3SAlex Crichton 1082329ecc3SAlex Crichton enum my-errno { 1092329ecc3SAlex Crichton bad1, 1102329ecc3SAlex Crichton bad2, 1112329ecc3SAlex Crichton } 1122329ecc3SAlex Crichton 113fd3a827eSAlex Crichton return-result-sugar: func() -> result<s32, my-errno>; 114fd3a827eSAlex Crichton return-result-sugar2: func() -> result<_, my-errno>; 115fd3a827eSAlex Crichton return-result-sugar3: func() -> result<my-errno, my-errno>; 116fd3a827eSAlex Crichton return-result-sugar4: func() -> result<tuple<s32, u32>, my-errno>; 117fd3a827eSAlex Crichton return-option-sugar: func() -> option<s32>; 118fd3a827eSAlex Crichton return-option-sugar2: func() -> option<my-errno>; 1192329ecc3SAlex Crichton 120fd3a827eSAlex Crichton result-simple: func() -> result<u32, s32>; 1212329ecc3SAlex Crichton 1222329ecc3SAlex Crichton record is-clone { 1232329ecc3SAlex Crichton v1: v1, 1242329ecc3SAlex Crichton } 1252329ecc3SAlex Crichton 126fd3a827eSAlex Crichton is-clone-arg: func(a: is-clone); 127fd3a827eSAlex Crichton is-clone-return: func() -> is-clone; 1282329ecc3SAlex Crichton} 1292329ecc3SAlex Crichton 13041417d9eSAlex Crichtonworld my-world { 131fd3a827eSAlex Crichton import variants; 132fd3a827eSAlex Crichton export variants; 1332329ecc3SAlex Crichton} 134