mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-21 09:40:13 +00:00
Classify function calls as functions when shadowed by types
This commit is contained in:
parent
f421ee6722
commit
426ad8e165
5 changed files with 31 additions and 16 deletions
|
@ -224,14 +224,18 @@ impl SourceAnalyzer {
|
|||
) -> Option<PathResolution> {
|
||||
if let Some(path_expr) = path.syntax().parent().and_then(ast::PathExpr::cast) {
|
||||
let expr_id = self.expr_id(db, &path_expr.into())?;
|
||||
if let Some(assoc) = self.infer.as_ref()?.assoc_resolutions_for_expr(expr_id) {
|
||||
let infer = self.infer.as_ref()?;
|
||||
if let Some(assoc) = infer.assoc_resolutions_for_expr(expr_id) {
|
||||
return Some(PathResolution::AssocItem(assoc.into()));
|
||||
}
|
||||
if let Some(VariantId::EnumVariantId(variant)) =
|
||||
self.infer.as_ref()?.variant_resolution_for_expr(expr_id)
|
||||
infer.variant_resolution_for_expr(expr_id)
|
||||
{
|
||||
return Some(PathResolution::Def(ModuleDef::Variant(variant.into())));
|
||||
}
|
||||
if let Some(func) = infer[expr_id].as_fn_def() {
|
||||
return Some(PathResolution::Def(ModuleDef::Function(func.into())));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(path_pat) = path.syntax().parent().and_then(ast::PathPat::cast) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue