diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-17 13:56:22 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-17 13:56:22 +0000 |
commit | f937d11ad892036fa93b25a2c19d10dcebe4ab24 (patch) | |
tree | 71f3719509f3fb46f5d2ce5a93da42ea67b23b70 /crates/ra_hir/src/code_model_impl | |
parent | edd4c1d8a6c270fe39ae881c23c722c658c87c32 (diff) | |
parent | 3c7c7e5a04306f8b68dffef2b5ca84628ed81ce2 (diff) |
Merge #843
843: Impl generics r=matklad a=flodiebold
This handles type parameters on impls when typing method calls.
~One remaining problem is that the autoderefs aren't applied during the unification of the method receiver type with the actual receiver type, which means that the type parameters are only correctly inferred if no autoderefs happened.~
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/code_model_impl')
-rw-r--r-- | crates/ra_hir/src/code_model_impl/function.rs | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs index b9438fdb7..c401528c6 100644 --- a/crates/ra_hir/src/code_model_impl/function.rs +++ b/crates/ra_hir/src/code_model_impl/function.rs | |||
@@ -3,22 +3,11 @@ use std::sync::Arc; | |||
3 | use ra_syntax::ast::{self, NameOwner}; | 3 | use ra_syntax::ast::{self, NameOwner}; |
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{ |
6 | HirDatabase, Name, AsName, Function, FnSignature, | 6 | Name, AsName, Function, FnSignature, |
7 | type_ref::{TypeRef, Mutability}, | 7 | type_ref::{TypeRef, Mutability}, |
8 | PersistentHirDatabase, | 8 | PersistentHirDatabase, |
9 | impl_block::ImplBlock, | ||
10 | }; | 9 | }; |
11 | 10 | ||
12 | impl Function { | ||
13 | // TODO impl_block should probably also be part of the code model API? | ||
14 | |||
15 | /// The containing impl block, if this is a method. | ||
16 | pub(crate) fn impl_block(&self, db: &impl HirDatabase) -> Option<ImplBlock> { | ||
17 | let module_impls = db.impls_in_module(self.module(db)); | ||
18 | ImplBlock::containing(module_impls, (*self).into()) | ||
19 | } | ||
20 | } | ||
21 | |||
22 | impl FnSignature { | 11 | impl FnSignature { |
23 | pub(crate) fn fn_signature_query( | 12 | pub(crate) fn fn_signature_query( |
24 | db: &impl PersistentHirDatabase, | 13 | db: &impl PersistentHirDatabase, |