2010-06-23 23:03:09 -05:00
|
|
|
// -*- rust -*-
|
|
|
|
|
2010-10-28 17:02:00 -05:00
|
|
|
fn id[T](&T x) -> T {
|
2010-06-23 23:03:09 -05:00
|
|
|
ret x;
|
|
|
|
}
|
|
|
|
|
|
|
|
type triple = tup(int,int,int);
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
auto x = 62;
|
|
|
|
auto y = 63;
|
|
|
|
auto a = 'a';
|
|
|
|
auto b = 'b';
|
|
|
|
|
|
|
|
let triple p = tup(65, 66, 67);
|
|
|
|
let triple q = tup(68, 69, 70);
|
|
|
|
|
|
|
|
y = id[int](x);
|
|
|
|
log y;
|
2011-05-02 18:24:09 -05:00
|
|
|
check (x == y);
|
2010-06-23 23:03:09 -05:00
|
|
|
|
|
|
|
b = id[char](a);
|
|
|
|
log b;
|
2011-05-02 18:24:09 -05:00
|
|
|
check (a == b);
|
2010-06-23 23:03:09 -05:00
|
|
|
|
|
|
|
q = id[triple](p);
|
|
|
|
x = p._2;
|
|
|
|
y = q._2;
|
|
|
|
log y;
|
2011-05-02 18:24:09 -05:00
|
|
|
check (x == y);
|
2010-06-23 23:03:09 -05:00
|
|
|
|
|
|
|
}
|