rust/src/test/run-pass/fun-call-variants.rs

15 lines
335 B
Rust
Raw Normal View History

// -*- rust -*-
2011-07-27 07:19:39 -05:00
fn ho(f: fn(int) -> int ) -> int { let n: int = f(3); ret n; }
2011-07-27 07:19:39 -05:00
fn direct(x: int) -> int { ret x + 1; }
2010-06-23 23:03:09 -05:00
fn main() {
2011-07-27 07:19:39 -05:00
let a: int =
direct(3); // direct
let b: int = ho(direct); // indirect unbound
2011-07-27 07:19:39 -05:00
let c: int =
ho(bind direct(_)); // indirect bound
assert (a == b);
assert (b == c);
}