aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-01-28 18:06:33 +0000
committerLukas Wirth <[email protected]>2021-01-28 18:08:55 +0000
commit426ad8e165aeb70a3d12b8bc870cb0c57a308bc7 (patch)
treed40c9d6ed4a234a0d3a56d14f64f97b8bf7fdf8b /crates/hir/src
parentf421ee672253499b8ca8d1badf98db42525a5216 (diff)
Classify function calls as functions when shadowed by types
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/source_analyzer.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index 30a8e513d..524120d08 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -224,14 +224,18 @@ impl SourceAnalyzer {
224 ) -> Option<PathResolution> { 224 ) -> Option<PathResolution> {
225 if let Some(path_expr) = path.syntax().parent().and_then(ast::PathExpr::cast) { 225 if let Some(path_expr) = path.syntax().parent().and_then(ast::PathExpr::cast) {
226 let expr_id = self.expr_id(db, &path_expr.into())?; 226 let expr_id = self.expr_id(db, &path_expr.into())?;
227 if let Some(assoc) = self.infer.as_ref()?.assoc_resolutions_for_expr(expr_id) { 227 let infer = self.infer.as_ref()?;
228 if let Some(assoc) = infer.assoc_resolutions_for_expr(expr_id) {
228 return Some(PathResolution::AssocItem(assoc.into())); 229 return Some(PathResolution::AssocItem(assoc.into()));
229 } 230 }
230 if let Some(VariantId::EnumVariantId(variant)) = 231 if let Some(VariantId::EnumVariantId(variant)) =
231 self.infer.as_ref()?.variant_resolution_for_expr(expr_id) 232 infer.variant_resolution_for_expr(expr_id)
232 { 233 {
233 return Some(PathResolution::Def(ModuleDef::Variant(variant.into()))); 234 return Some(PathResolution::Def(ModuleDef::Variant(variant.into())));
234 } 235 }
236 if let Some(func) = infer[expr_id].as_fn_def() {
237 return Some(PathResolution::Def(ModuleDef::Function(func.into())));
238 }
235 } 239 }
236 240
237 if let Some(path_pat) = path.syntax().parent().and_then(ast::PathPat::cast) { 241 if let Some(path_pat) = path.syntax().parent().and_then(ast::PathPat::cast) {