summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2011-12-16 13:50:22 -0800
committerNiko Matsakis <niko@alum.mit.edu>2011-12-19 14:07:46 -0800
commit98cbbbb64241ac8fe7f0aeb453a8e4a5f55b081c (patch)
treea55900b2421597082dc73482452b0d60a1481e33 /src/test
parent1bc6e72b97a4e35102ac6b2519dd0a48f5b5db1f (diff)
downloadrust-98cbbbb64241ac8fe7f0aeb453a8e4a5f55b081c.tar.gz
rust-98cbbbb64241ac8fe7f0aeb453a8e4a5f55b081c.zip
impl the proper partial order between fn types
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/sendfn-is-not-a-lambda.rs10
-rw-r--r--src/test/run-pass/sendfn-is-a-block.rs8
2 files changed, 18 insertions, 0 deletions
diff --git a/src/test/compile-fail/sendfn-is-not-a-lambda.rs b/src/test/compile-fail/sendfn-is-not-a-lambda.rs
new file mode 100644
index 00000000000..696f237c9f1
--- /dev/null
+++ b/src/test/compile-fail/sendfn-is-not-a-lambda.rs
@@ -0,0 +1,10 @@
+// error-pattern: mismatched types: expected lambda(++uint) -> uint
+
+fn test(f: lambda(uint) -> uint) -> uint {
+    ret f(22u);
+}
+
+fn main() {
+    let f = sendfn(x: uint) -> uint { ret 4u; };
+    log test(f);
+}
\ No newline at end of file
diff --git a/src/test/run-pass/sendfn-is-a-block.rs b/src/test/run-pass/sendfn-is-a-block.rs
new file mode 100644
index 00000000000..3761c1ec652
--- /dev/null
+++ b/src/test/run-pass/sendfn-is-a-block.rs
@@ -0,0 +1,8 @@
+fn test(f: block(uint) -> uint) -> uint {
+    ret f(22u);
+}
+
+fn main() {
+    let y = test(sendfn(x: uint) -> uint { ret 4u * x; });
+    assert y == 88u;
+}
\ No newline at end of file