Test that fn preconditions get typechecked

This commit is contained in:
Tim Chevalier 2011-08-30 16:21:00 -07:00
parent 2e53da5126
commit d37e8cfc67

View File

@ -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));
}