aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/call_info.rs13
-rw-r--r--crates/ra_ide_api/src/change.rs2
-rw-r--r--crates/ra_ide_api/src/completion/presentation.rs2
-rw-r--r--crates/ra_ide_api/src/references/classify.rs10
4 files changed, 13 insertions, 14 deletions
diff --git a/crates/ra_ide_api/src/call_info.rs b/crates/ra_ide_api/src/call_info.rs
index 7c367230e..9beceb29c 100644
--- a/crates/ra_ide_api/src/call_info.rs
+++ b/crates/ra_ide_api/src/call_info.rs
@@ -26,14 +26,17 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<Cal
26 ); 26 );
27 let (mut call_info, has_self) = match &calling_node { 27 let (mut call_info, has_self) = match &calling_node {
28 FnCallNode::CallExpr(expr) => { 28 FnCallNode::CallExpr(expr) => {
29 //FIXME: apply subst 29 //FIXME: don't poke into Ty
30 let (callable_def, _subst) = analyzer.type_of(db, &expr.expr()?)?.as_callable()?; 30 let (callable_def, _subst) = analyzer.type_of(db, &expr.expr()?)?.as_callable()?;
31 match callable_def { 31 match callable_def {
32 hir::CallableDef::Function(it) => { 32 hir::CallableDef::FunctionId(it) => {
33 (CallInfo::with_fn(db, it), it.has_self_param(db)) 33 let fn_def = it.into();
34 (CallInfo::with_fn(db, fn_def), fn_def.has_self_param(db))
35 }
36 hir::CallableDef::StructId(it) => (CallInfo::with_struct(db, it.into())?, false),
37 hir::CallableDef::EnumVariantId(it) => {
38 (CallInfo::with_enum_variant(db, it.into())?, false)
34 } 39 }
35 hir::CallableDef::Struct(it) => (CallInfo::with_struct(db, it)?, false),
36 hir::CallableDef::EnumVariant(it) => (CallInfo::with_enum_variant(db, it)?, false),
37 } 40 }
38 } 41 }
39 FnCallNode::MethodCallExpr(expr) => { 42 FnCallNode::MethodCallExpr(expr) => {
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs
index 8a05b287f..0f692460d 100644
--- a/crates/ra_ide_api/src/change.rs
+++ b/crates/ra_ide_api/src/change.rs
@@ -324,7 +324,7 @@ impl RootDatabase {
324 hir::db::ExprScopesQuery 324 hir::db::ExprScopesQuery
325 hir::db::InferQuery 325 hir::db::InferQuery
326 hir::db::TypeForDefQuery 326 hir::db::TypeForDefQuery
327 hir::db::TypeForFieldQuery 327 hir::db::FieldTypesQuery
328 hir::db::CallableItemSignatureQuery 328 hir::db::CallableItemSignatureQuery
329 hir::db::GenericPredicatesQuery 329 hir::db::GenericPredicatesQuery
330 hir::db::GenericDefaultsQuery 330 hir::db::GenericDefaultsQuery
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs
index bac3f7582..85b053a6e 100644
--- a/crates/ra_ide_api/src/completion/presentation.rs
+++ b/crates/ra_ide_api/src/completion/presentation.rs
@@ -292,7 +292,7 @@ fn is_deprecated(node: impl HasAttrs, db: &impl HirDatabase) -> bool {
292} 292}
293 293
294fn has_non_default_type_params(def: hir::GenericDef, db: &db::RootDatabase) -> bool { 294fn has_non_default_type_params(def: hir::GenericDef, db: &db::RootDatabase) -> bool {
295 let subst = db.generic_defaults(def); 295 let subst = db.generic_defaults(def.into());
296 subst.iter().any(|ty| ty == &Ty::Unknown) 296 subst.iter().any(|ty| ty == &Ty::Unknown)
297} 297}
298 298
diff --git a/crates/ra_ide_api/src/references/classify.rs b/crates/ra_ide_api/src/references/classify.rs
index 4a4b030f8..cab06dea9 100644
--- a/crates/ra_ide_api/src/references/classify.rs
+++ b/crates/ra_ide_api/src/references/classify.rs
@@ -1,6 +1,6 @@
1//! Functions that are used to classify an element from its definition or reference. 1//! Functions that are used to classify an element from its definition or reference.
2 2
3use hir::{FromSource, Module, ModuleSource, Path, PathResolution, Source, SourceAnalyzer}; 3use hir::{FromSource, Module, ModuleSource, PathResolution, Source, SourceAnalyzer};
4use ra_prof::profile; 4use ra_prof::profile;
5use ra_syntax::{ast, match_ast, AstNode}; 5use ra_syntax::{ast, match_ast, AstNode};
6use test_utils::tested_by; 6use test_utils::tested_by;
@@ -140,12 +140,8 @@ pub(crate) fn classify_name_ref(
140 140
141 if let Some(record_field) = ast::RecordField::cast(parent.clone()) { 141 if let Some(record_field) = ast::RecordField::cast(parent.clone()) {
142 tested_by!(goto_definition_works_for_record_fields); 142 tested_by!(goto_definition_works_for_record_fields);
143 if let Some(record_lit) = record_field.syntax().ancestors().find_map(ast::RecordLit::cast) { 143 if let Some(field_def) = analyzer.resolve_record_field(&record_field) {
144 let variant_def = analyzer.resolve_record_literal(&record_lit)?; 144 return Some(from_struct_field(db, field_def));
145 let hir_path = Path::from_name_ref(name_ref.value);
146 let hir_name = hir_path.as_ident()?;
147 let field = variant_def.field(db, hir_name)?;
148 return Some(from_struct_field(db, field));
149 } 145 }
150 } 146 }
151 147