mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Diagnose call expression on non-callable things
This commit is contained in:
parent
3ba876a4a6
commit
3c7a0aa00e
6 changed files with 83 additions and 14 deletions
|
@ -170,6 +170,7 @@ pub enum InferenceDiagnostic {
|
|||
// FIXME: Make this proper
|
||||
BreakOutsideOfLoop { expr: ExprId, is_break: bool, bad_value_break: bool },
|
||||
MismatchedArgCount { call_expr: ExprId, expected: usize, found: usize },
|
||||
ExpectedFunction { call_expr: ExprId, found: Ty },
|
||||
}
|
||||
|
||||
/// A mismatch between an expected and an inferred type.
|
||||
|
@ -505,6 +506,14 @@ impl<'a> InferenceContext<'a> {
|
|||
mismatch.expected = table.resolve_completely(mismatch.expected.clone());
|
||||
mismatch.actual = table.resolve_completely(mismatch.actual.clone());
|
||||
}
|
||||
for diagnostic in &mut result.diagnostics {
|
||||
match diagnostic {
|
||||
InferenceDiagnostic::ExpectedFunction { found, .. } => {
|
||||
*found = table.resolve_completely(found.clone())
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
for (_, subst) in result.method_resolutions.values_mut() {
|
||||
*subst = table.resolve_completely(subst.clone());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue