Introduce a T_err type for type errors

This allows more errors to be non-fatal, as per #1871.

I only went through and started changing span_fatal to span_err in
check.rs. There are probably more errors that could be made
non-fatal. So if you see derived type errors appearing from now on,
file a bug!

r=graydon

Closes #1871
This commit is contained in:
Tim Chevalier 2012-11-16 19:22:48 -08:00
parent 77ef4e7176
commit ef833d4101
15 changed files with 256 additions and 146 deletions

View file

@ -1,2 +1,2 @@
// error-pattern: cast from nil: () as u32
// error-pattern: cast from nil: `()` as `u32`
fn main() { let u = (assert true) as u32; }

View file

@ -1,2 +1,2 @@
// error-pattern: cast to nil: u32 as ()
// error-pattern: cast to nil: `u32` as `()`
fn main() { let u = 0u32 as (); }

View file

@ -1,4 +1,4 @@
// error-pattern:expected function or foreign function but found *u8
// error-pattern:expected function or foreign function but found `*u8`
extern fn f() {
}

View file

@ -1,11 +1,12 @@
// xfail-test
// Tests that we don't generate a spurious error about f.honk's type
// being undeterminable
fn main() {
let f = 42;
let _g = if f < 5 {
f.honk();
f.honk() //~ ERROR attempted access of field `honk`
}
else {
12
()
};
}

View file

@ -11,5 +11,5 @@ impl<A> ~[A]: vec_monad<A> {
}
}
fn main() {
["hi"].bind({|x| [x] });
["hi"].bind({|x| [x] }); //~ ERROR attempted access of field `bind`
}