about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2011-08-30 16:21:00 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2011-08-30 16:39:17 -0700
commitd37e8cfc6723f0f2dbefdb686a7e220062c1374c (patch)
tree3c8ef67417116244e7df1368a8cb911e6ce2b75b /src/test
parent2e53da5126b970b394205256446c36a585e0f35e (diff)
downloadrust-d37e8cfc6723f0f2dbefdb686a7e220062c1374c.tar.gz
rust-d37e8cfc6723f0f2dbefdb686a7e220062c1374c.zip
Test that fn preconditions get typechecked
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/nonsense-constraints.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/compile-fail/nonsense-constraints.rs b/src/test/compile-fail/nonsense-constraints.rs
new file mode 100644
index 00000000000..9ed12810ab5
--- /dev/null
+++ b/src/test/compile-fail/nonsense-constraints.rs
@@ -0,0 +1,18 @@
+// Tests that the typechecker checks constraints
+// error-pattern:mismatched types: expected uint but found u8
+use std;
+import std::uint;
+
+fn enum_chars(start:u8, end:u8) : uint::le(start, end) -> [char] {
+    let i = start;
+    let r = [];
+    while (i <= end) {
+        r += [i as char];
+        i += (1u as u8);
+    }
+    ret r;
+}
+
+fn main() {
+    log (enum_chars('a' as u8, 'z' as u8));
+}
\ No newline at end of file