fc6b7c8b38
Long lines were fixed in a very crude way, as I'll be following up with another reformat in a bit.
16 lines
325 B
Rust
16 lines
325 B
Rust
tag t1 { a(int); b(uint); }
|
|
type t2 = {x: t1, y: int};
|
|
tag t3 { c(t2, uint); }
|
|
|
|
fn m(in: t3) -> int {
|
|
alt in {
|
|
c({x: a(m), _}, _) { ret m; }
|
|
c({x: b(m), y: y}, z) { ret (m + z as int) + y; }
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
assert (m(c({x: a(10), y: 5}, 4u)) == 10);
|
|
assert (m(c({x: b(10u), y: 5}, 4u)) == 19);
|
|
}
|