From 4a6cdd776d403bacce0a5471d77e8c76695c5bc5 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 23 May 2021 16:59:23 +0200 Subject: Record method call substs and use them in call info --- crates/hir/src/source_analyzer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir/src/source_analyzer.rs') diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs index b5c65808e..a1a9c727a 100644 --- a/crates/hir/src/source_analyzer.rs +++ b/crates/hir/src/source_analyzer.rs @@ -143,7 +143,7 @@ impl SourceAnalyzer { &self, db: &dyn HirDatabase, call: &ast::MethodCallExpr, - ) -> Option { + ) -> Option<(FunctionId, Substitution)> { let expr_id = self.expr_id(db, &call.clone().into())?; self.infer.as_ref()?.method_resolution(expr_id) } -- cgit v1.2.3 From b8262099cc51065259daf10b4b23ff49ce74434f Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 23 May 2021 23:54:35 +0200 Subject: Get rid of field_type again --- crates/hir/src/source_analyzer.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/hir/src/source_analyzer.rs') diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs index a1a9c727a..5a3d80e8e 100644 --- a/crates/hir/src/source_analyzer.rs +++ b/crates/hir/src/source_analyzer.rs @@ -161,7 +161,7 @@ impl SourceAnalyzer { &self, db: &dyn HirDatabase, field: &ast::RecordExprField, - ) -> Option<(Field, Option)> { + ) -> Option<(Field, Option, Type)> { let record_expr = ast::RecordExpr::cast(field.syntax().parent().and_then(|p| p.parent())?)?; let expr = ast::Expr::from(record_expr); let expr_id = self.body_source_map.as_ref()?.node_expr(InFile::new(self.file_id, &expr))?; @@ -178,10 +178,13 @@ impl SourceAnalyzer { _ => None, } }; + let (_, subst) = self.infer.as_ref()?.type_of_expr.get(expr_id)?.as_adt()?; let variant = self.infer.as_ref()?.variant_resolution_for_expr(expr_id)?; let variant_data = variant.variant_data(db.upcast()); let field = FieldId { parent: variant, local_id: variant_data.field(&local_name)? }; - Some((field.into(), local)) + let field_ty = + db.field_types(variant).get(field.local_id)?.clone().substitute(&Interner, subst); + Some((field.into(), local, Type::new_with_resolver(db, &self.resolver, field_ty)?)) } pub(crate) fn resolve_record_pat_field( -- cgit v1.2.3