if (resolved_fn_trait_call)
return;
- bool valid_tyty = function_tyty->get_kind () == TyTy::TypeKind::FNDEF
- || function_tyty->get_kind () == TyTy::TypeKind::FNPTR;
+ bool valid_tyty
+ = function_tyty->is<TyTy::FnType> () || function_tyty->is<TyTy::FnPtr> ();
if (!valid_tyty)
{
- rust_error_at (expr.get_locus (),
- "Failed to resolve expression of function call");
+ bool emit_error = !function_tyty->is<TyTy::ErrorType> ();
+ if (emit_error)
+ {
+ rich_location r (line_table, expr.get_locus ());
+ rust_error_at (r, ErrorCode::E0618, "expected function, found %<%s%>",
+ function_tyty->get_name ().c_str ());
+ }
return;
}
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 resolve expression of function call} "" { target *-*-* } .-1 }
let b2: i32 = a2.0;
// { dg-error {Expected Tuple or ADT got: T\?} "" { target *-*-* } .-1 }
fn main() {
let a: i32 = Foo::test(); // { dg-error "multiple applicable items in scope for: .test." }
- // { dg-error {Failed to resolve expression of function call} "" { target *-*-* } .-1 }
}
--- /dev/null
+fn func(i: i32) {
+ i();
+ // { dg-error "expected function, found .i32. .E0618." "" { target *-*-* } .-1 }
+}
+
+fn main() {
+ let i = 0i32;
+ i();
+ // { dg-error "expected function, found .i32. .E0618." "" { 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 resolve expression of function call} "" { target *-*-* } .-2 }
}
fn main() {
let a = Foo::test();
// { dg-error "expected" "" { target *-*-* } .-1 }
- // { dg-error "Failed to resolve expression of function call" "" { target *-*-* } .-2 }
}