2010-06-23 21:03:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
// -*- rust -*-
|
2011-08-23 15:58:53 -07:00
|
|
|
fn id<@T>(x: &T) -> T { ret x; }
|
2010-06-23 21:03:09 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
type triple = {x: int, y: int, z: int};
|
2010-06-23 21:03:09 -07:00
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
fn main() {
|
2011-07-27 14:19:39 +02:00
|
|
|
let x = 62;
|
|
|
|
let y = 63;
|
|
|
|
let a = 'a';
|
|
|
|
let b = 'b';
|
|
|
|
let p: triple = {x: 65, y: 66, z: 67};
|
|
|
|
let q: triple = {x: 68, y: 69, z: 70};
|
2011-08-13 00:10:18 -07:00
|
|
|
y = id::<int>(x);
|
2011-06-15 11:19:50 -07:00
|
|
|
log y;
|
|
|
|
assert (x == y);
|
2011-08-13 00:10:18 -07:00
|
|
|
b = id::<char>(a);
|
2011-06-15 11:19:50 -07:00
|
|
|
log b;
|
|
|
|
assert (a == b);
|
2011-08-13 00:10:18 -07:00
|
|
|
q = id::<triple>(p);
|
2011-07-26 14:49:40 +02:00
|
|
|
x = p.z;
|
|
|
|
y = q.z;
|
2011-06-15 11:19:50 -07:00
|
|
|
log y;
|
|
|
|
assert (x == y);
|
2011-08-12 06:37:25 -07:00
|
|
|
}
|