aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
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) {