new test showing off the improved inference
This commit is contained in:
parent
7f12358656
commit
daf0d63a59
1 changed files with 8 additions and 0 deletions
8
src/test/run-pass/closure-inference.rs
Normal file
8
src/test/run-pass/closure-inference.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fn foo(i: int) -> int { i + 1 }
|
||||||
|
|
||||||
|
fn apply<A>(f: fn(A) -> A, v: A) -> A { f(v) }
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let f = {|i| foo(i)};
|
||||||
|
assert apply(f, 2) == 3;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue