2010-06-23 23:03:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
// -*- rust -*-
|
|
|
|
fn id[T](&T x) -> T { ret x; }
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2011-07-26 07:49:40 -05:00
|
|
|
type triple = rec(int x, int y, int z);
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
fn main() {
|
|
|
|
auto x = 62;
|
|
|
|
auto y = 63;
|
|
|
|
auto a = 'a';
|
|
|
|
auto b = 'b';
|
2011-07-26 07:49:40 -05:00
|
|
|
let triple p = rec(x=65, y=66, z=67);
|
|
|
|
let triple q = rec(x=68, y=69, z=70);
|
2011-06-15 13:19:50 -05:00
|
|
|
y = id[int](x);
|
|
|
|
log y;
|
|
|
|
assert (x == y);
|
|
|
|
b = id[char](a);
|
|
|
|
log b;
|
|
|
|
assert (a == b);
|
|
|
|
q = id[triple](p);
|
2011-07-26 07:49:40 -05:00
|
|
|
x = p.z;
|
|
|
|
y = q.z;
|
2011-06-15 13:19:50 -05:00
|
|
|
log y;
|
|
|
|
assert (x == y);
|
|
|
|
}
|