2012-01-19 20:31:08 -06:00
|
|
|
enum t1 { a(int), b(uint), }
|
2011-07-27 07:19:39 -05:00
|
|
|
type t2 = {x: t1, y: int};
|
2012-01-19 20:31:08 -06:00
|
|
|
enum t3 { c(t2, uint), }
|
2011-07-11 07:13:20 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn m(in: t3) -> int {
|
2011-07-11 07:13:20 -05:00
|
|
|
alt in {
|
2011-07-27 07:19:39 -05:00
|
|
|
c({x: a(m), _}, _) { ret m; }
|
|
|
|
c({x: b(m), y: y}, z) { ret (m + z as int) + y; }
|
2011-07-11 07:13:20 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2011-07-27 07:19:39 -05:00
|
|
|
assert (m(c({x: a(10), y: 5}, 4u)) == 10);
|
|
|
|
assert (m(c({x: b(10u), y: 5}, 4u)) == 19);
|
2011-08-19 17:16:48 -05:00
|
|
|
}
|