Better type inference for chans and ports.

This commit is contained in:
Eric Holk 2011-08-17 17:13:11 -07:00
parent f023f82090
commit 3ab21e5ee0
6 changed files with 65 additions and 59 deletions

View file

@ -25,3 +25,19 @@ fn send_recv_fn() {
comm::send(c, 42);
assert(comm::recv(p) == 42);
}
#[test]
fn send_recv_fn_infer() {
let p = comm::port();
let c = comm::chan(p);
comm::send(c, 42);
assert(comm::recv(p) == 42);
}
#[test]
fn chan_chan() {
let p = comm::port(), p2 = comm::port::<int>();
let c = comm::chan(p);
comm::send(c, comm::chan(p2));
let c2 = comm::recv(p);
}