Skip to content

Commit d37e8cf

Browse files
committed
Test that fn preconditions get typechecked
1 parent 2e53da5 commit d37e8cf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Tests that the typechecker checks constraints
2+
// error-pattern:mismatched types: expected uint but found u8
3+
use std;
4+
import std::uint;
5+
6+
fn enum_chars(start:u8, end:u8) : uint::le(start, end) -> [char] {
7+
let i = start;
8+
let r = [];
9+
while (i <= end) {
10+
r += [i as char];
11+
i += (1u as u8);
12+
}
13+
ret r;
14+
}
15+
16+
fn main() {
17+
log (enum_chars('a' as u8, 'z' as u8));
18+
}

0 commit comments

Comments
 (0)