diff --git a/src/test/compile-fail/nonsense-constraints.rs b/src/test/compile-fail/nonsense-constraints.rs new file mode 100644 index 000000000000..9ed12810ab5f --- /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