2011-05-31 18:11:30 -05:00
|
|
|
use std;
|
|
|
|
import std::uint;
|
|
|
|
|
2011-07-26 07:49:40 -05:00
|
|
|
fn test(bool x, @rec(int x, int y, int z) foo) -> int {
|
2011-05-31 18:11:30 -05:00
|
|
|
auto bar = foo;
|
2011-07-26 07:49:40 -05:00
|
|
|
let @rec(int x, int y, int z) y;
|
2011-05-31 18:11:30 -05:00
|
|
|
if (x) {
|
|
|
|
y <- bar;
|
|
|
|
} else {
|
2011-07-26 07:49:40 -05:00
|
|
|
y = @rec(x=4, y=5, z=6);
|
2011-05-31 18:11:30 -05:00
|
|
|
}
|
2011-07-26 07:49:40 -05:00
|
|
|
ret y.y;
|
2011-05-31 18:11:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2011-07-26 07:49:40 -05:00
|
|
|
auto x = @rec(x=1, y=2, z=3);
|
2011-05-31 18:11:30 -05:00
|
|
|
for each (uint i in uint::range(0u, 10000u)) {
|
|
|
|
assert (test(true, x) == 2);
|
|
|
|
}
|
|
|
|
assert (test(false, x) == 5);
|
|
|
|
}
|