expr->accept_vis (resolver);
if (resolver.infered == nullptr)
- {
- // FIXME
- // this is an internal error message for debugging and should be removed
- // at some point
- rust_error_at (expr->get_locus (), "failed to type resolve expression");
- return new TyTy::ErrorType (expr->get_mappings ().get_hirid ());
- }
+ return new TyTy::ErrorType (expr->get_mappings ().get_hirid ());
auto ref = expr->get_mappings ().get_hirid ();
resolver.infered->set_ref (ref);
let a;
a = 1;
break a; // { dg-error "cannot 'break' outside of a loop" }
- // { dg-error "failed to type resolve expression" "" { target *-*-* } .-1 }
}
while b > 10 {
if (b == 2) {
break b; // { dg-error "can only break with a value inside 'loop'" }
- // { dg-error "failed to type resolve expression" "" { target *-*-* } .-1 }
}
c = a + b;
a = b;
let a = Foo;
a.test();
// { dg-error "failed to resolve method for .test." "" { target *-*-* } .-1 }
- // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
}
let _fib = {
continue; // { dg-error "cannot 'continue' outside of a loop" }
- // { dg-error "failed to type resolve expression" "" { target *-*-* } .-1 }
123
};
}
fn main() {
let a2;
a2 = GenericStruct::<i8, i32>(1, 456); // { dg-error "generic item takes at most 1 type arguments but 2 were supplied" }
- // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
- // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-2 }
- // { duplicate _dg-error {failed to type resolve expression} "" { target *-*-* } .-3 }
+ // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-1 }
let b2: i32 = a2.0;
// { dg-error {Expected Tuple or ADT got: T\?} "" { target *-*-* } .-1 }
- // { dg-error {failed to type resolve expression} "" { target *-*-* } .-2 }
let c2: usize = a2.1;
// { dg-error {Expected Tuple or ADT got: T\?} "" { target *-*-* } .-1 }
- // { dg-error {failed to type resolve expression} "" { target *-*-* } .-2 }
}
fn main() {
let a: i32 = Foo::test(); // { dg-error "multiple applicable items in scope for: test" }
- // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
- // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-2 }
- // { duplicate _dg-error {failed to type resolve expression} "" { target *-*-* } .-3 }
+ // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-1 }
}
let a = Foo { a: 123 };
a.bar();
// { dg-error "multiple candidates found for method .bar." "" { target *-*-* } .-1 }
- // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
}
fn main() {
match Foo(true) {
- // { dg-error "failed to type resolve expression" "" { target *-*-* } .-1 }
foo(x)
// { dg-error "expected tuple struct/variant, found" "" { target *-*-* } .-1 }
=> ()
let a: u16 = 123;
a.foo();
// { dg-error "failed to resolve method for .foo." "" { target *-*-* } .-1 }
- // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
}
fn foo<T: Deref<Target = i32>>(t: &T) -> i32 {
t.max(2)
// { dg-error "failed to resolve method for .max." "" { target *-*-* } .-1 }
- // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
}
let a = S;
a.foo();
// { dg-error "multiple candidates found for method .foo." "" { target *-*-* } .-1 }
- // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
}
a.test();
// { dg-error "failed to resolve method for .test." "" { target *-*-* } .-1 }
- // { dg-error {failed to type resolve expression} "" { target *-*-* } .-2 }
}
let mut x;
x = true;
x = x + 2; // { dg-error "cannot apply this operator to types bool and <integer>" }
- // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
}
let a;
a = Foo::<A = i32, B = f32>(123f32);
// { dg-error "associated type bindings are not allowed here" "" { target *-*-* } .-1 }
- // { dg-error {failed to type resolve expression} "" { target *-*-* } .-2 }
- // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-3 }
- // { duplicate _dg-error {failed to type resolve expression} "" { target *-*-* } .-4 }
+ // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-2 }
}
let d: i32 = !3;
let e: f32 = -true; // // { dg-error "cannot apply unary - to bool" }
- // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
}
let d: i32 = !3;
let e: f32 = !5f32; // { dg-error "cannot apply unary '!' to f32" }
- // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
}
let a = Foo::test();
// { dg-error "expected" "" { target *-*-* } .-1 }
// { dg-error "Failed to resolve expression of function call" "" { target *-*-* } .-2 }
- // { dg-error "failed to type resolve expression" "" { target *-*-* } .-3 }
}
let a = [1, 2, 3];
let b: u32 = 1;
let c = a[b]; // { dg-error "the type ...integer..CAPACITY.. cannot be indexed by .u32." }
- // { dg-error {failed to type resolve expression} "" { target *-*-* } .-1 }
}