When checking loop bodies and do-expr bodies, don't require the expected type to exist

If the expected type is none (due to a type error), we shouldn't fail with an ICE, but
rather, just print out another type error. Changed the do-expr type error message to
make sense in this context (see the test case for how it works).

Closes #3044.
This commit is contained in:
Tim Chevalier 2012-08-02 18:11:29 -07:00
parent c9c3a49bfc
commit c2bb2f0837
2 changed files with 21 additions and 10 deletions

View file

@ -0,0 +1,9 @@
// error-pattern: Non-function passed to a `do` function as its last argument, or wrong number of arguments passed to a `do` function
fn main() {
let needlesArr: ~[char] = ~['a', 'f'];
do vec::foldr(needlesArr) |x, y| {
}
// for some reason if I use the new error syntax for the two error messages this generates,
// the test runner gets confused -- tjc
}