diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2011-08-30 16:21:00 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2011-08-30 16:39:17 -0700 |
| commit | d37e8cfc6723f0f2dbefdb686a7e220062c1374c (patch) | |
| tree | 3c8ef67417116244e7df1368a8cb911e6ce2b75b /src/test | |
| parent | 2e53da5126b970b394205256446c36a585e0f35e (diff) | |
| download | rust-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.rs | 18 |
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 |
