diff options
author | Florian Diebold <[email protected]> | 2019-12-03 13:59:29 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-12-03 14:01:23 +0000 |
commit | e4add45951511f9afe348bf6066a724deb0d3ccf (patch) | |
tree | 0a357e2d3333a06e37f5cb8d6613733c1c0c78ac /crates/ra_hir_ty/src/infer/path.rs | |
parent | ba4f7fa02f746e5bb3efdaa06c2b35beaa4e3440 (diff) |
Fix #2467
The stand-alone `unify` requires that the type doesn't contain any type
variables. So we can't share the code here for now (without more refactoring)...
Diffstat (limited to 'crates/ra_hir_ty/src/infer/path.rs')
-rw-r--r-- | crates/ra_hir_ty/src/infer/path.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/infer/path.rs b/crates/ra_hir_ty/src/infer/path.rs index b0024c6e1..37db005ea 100644 --- a/crates/ra_hir_ty/src/infer/path.rs +++ b/crates/ra_hir_ty/src/infer/path.rs | |||
@@ -1,5 +1,7 @@ | |||
1 | //! Path expression resolution. | 1 | //! Path expression resolution. |
2 | 2 | ||
3 | use std::iter; | ||
4 | |||
3 | use hir_def::{ | 5 | use hir_def::{ |
4 | path::{Path, PathKind, PathSegment}, | 6 | path::{Path, PathKind, PathSegment}, |
5 | resolver::{ResolveValueResult, Resolver, TypeNs, ValueNs}, | 7 | resolver::{ResolveValueResult, Resolver, TypeNs, ValueNs}, |
@@ -207,7 +209,16 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
207 | }; | 209 | }; |
208 | let substs = match container { | 210 | let substs = match container { |
209 | ContainerId::ImplId(impl_id) => { | 211 | ContainerId::ImplId(impl_id) => { |
210 | method_resolution::inherent_impl_substs(self.db, impl_id, &ty) | 212 | let impl_substs = Substs::build_for_def(self.db, impl_id) |
213 | .fill(iter::repeat_with(|| self.table.new_type_var())) | ||
214 | .build(); | ||
215 | let impl_self_ty = self.db.impl_self_ty(impl_id).subst(&impl_substs); | ||
216 | let substs = Substs::build_for_def(self.db, item) | ||
217 | .use_parent_substs(&impl_substs) | ||
218 | .fill_with_params() | ||
219 | .build(); | ||
220 | self.unify(&impl_self_ty, &ty); | ||
221 | Some(substs) | ||
211 | } | 222 | } |
212 | ContainerId::TraitId(trait_) => { | 223 | ContainerId::TraitId(trait_) => { |
213 | // we're picking this method | 224 | // we're picking this method |