Better type inference for chans and ports.
This commit is contained in:
parent
f023f82090
commit
3ab21e5ee0
6 changed files with 65 additions and 59 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue