diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-16 13:00:41 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-16 13:00:41 +0100 |
commit | b81caed43f1886024ededad41a1baa8a03f1d2f4 (patch) | |
tree | 0a0289899ec59b425eae6369929a01e97065ce43 /crates/ra_ide_api/src | |
parent | e6fbff3246cdd3278ff1c376d5abfc1d579f86c2 (diff) | |
parent | ad3673d8d86a9b8f1a8dba858abd7cabaa1d5776 (diff) |
Merge #1408
1408: Associated type basics & Deref support r=matklad a=flodiebold
This adds the necessary Chalk integration to handle associated types and uses it to implement support for `Deref` in the `*` operator and autoderef; so e.g. dot completions through an `Arc` work now.
It doesn't yet implement resolution of associated types in paths, though. Also, there's a big FIXME about handling variables in the solution we get from Chalk correctly.
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_dot.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/goto_type_definition.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index 0822a0e7e..f26fd06b3 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs | |||
@@ -15,7 +15,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) { | |||
15 | } | 15 | } |
16 | 16 | ||
17 | fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) { | 17 | fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) { |
18 | for receiver in receiver.autoderef(ctx.db) { | 18 | for receiver in ctx.analyzer.autoderef(ctx.db, receiver) { |
19 | if let Ty::Apply(a_ty) = receiver { | 19 | if let Ty::Apply(a_ty) = receiver { |
20 | match a_ty.ctor { | 20 | match a_ty.ctor { |
21 | TypeCtor::Adt(AdtDef::Struct(s)) => { | 21 | TypeCtor::Adt(AdtDef::Struct(s)) => { |
diff --git a/crates/ra_ide_api/src/goto_type_definition.rs b/crates/ra_ide_api/src/goto_type_definition.rs index 0f638b170..6f5164e0b 100644 --- a/crates/ra_ide_api/src/goto_type_definition.rs +++ b/crates/ra_ide_api/src/goto_type_definition.rs | |||
@@ -30,7 +30,7 @@ pub(crate) fn goto_type_definition( | |||
30 | return None; | 30 | return None; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | let adt_def = ty.autoderef(db).find_map(|ty| ty.as_adt().map(|adt| adt.0))?; | 33 | let adt_def = analyzer.autoderef(db, ty).find_map(|ty| ty.as_adt().map(|adt| adt.0))?; |
34 | 34 | ||
35 | let nav = NavigationTarget::from_adt_def(db, adt_def); | 35 | let nav = NavigationTarget::from_adt_def(db, adt_def); |
36 | Some(RangeInfo::new(node.range(), vec![nav])) | 36 | Some(RangeInfo::new(node.range(), vec![nav])) |