Skip to content

Commit 66856a3

Browse files
committed
add tests I forgot to add
1 parent 627217f commit 66856a3

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// error-pattern: copying a noncopyable value
2+
3+
fn to_lambda1(f: lambda(uint) -> uint) -> lambda(uint) -> uint {
4+
ret f;
5+
}
6+
7+
fn to_lambda2(b: block(uint) -> uint) -> lambda(uint) -> uint {
8+
ret to_lambda1({|x| b(x)});
9+
}
10+
11+
fn main() {
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
fn to_lambda(f: lambda(uint) -> uint) -> lambda(uint) -> uint {
2+
ret f;
3+
}
4+
5+
fn main() {
6+
let x: lambda(uint) -> uint = to_lambda({ |x| x * 2u });
7+
let y = to_lambda(x);
8+
9+
let x_r = x(22u);
10+
let y_r = y(x_r);
11+
12+
assert x_r == 44u;
13+
assert y_r == 88u;
14+
}

0 commit comments

Comments
 (0)