aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/lower.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/lower.rs')
-rw-r--r--crates/ra_hir/src/ty/lower.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index 0ac7920bb..805a73ff5 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -28,7 +28,7 @@ use crate::{
28 db::HirDatabase, 28 db::HirDatabase,
29 ty::{ 29 ty::{
30 primitive::{FloatTy, IntTy}, 30 primitive::{FloatTy, IntTy},
31 utils::all_super_traits, 31 utils::{all_super_traits, associated_type_by_name_including_super_traits},
32 Adt, 32 Adt,
33 }, 33 },
34 util::make_mut_slice, 34 util::make_mut_slice,
@@ -170,14 +170,16 @@ impl Ty {
170 ); 170 );
171 return if remaining_segments.len() == 1 { 171 return if remaining_segments.len() == 1 {
172 let segment = &remaining_segments[0]; 172 let segment = &remaining_segments[0];
173 match trait_ref 173 let associated_ty = associated_type_by_name_including_super_traits(
174 .trait_ 174 db,
175 .associated_type_by_name_including_super_traits(db, &segment.name) 175 trait_ref.trait_.id,
176 { 176 &segment.name,
177 );
178 match associated_ty {
177 Some(associated_ty) => { 179 Some(associated_ty) => {
178 // FIXME handle type parameters on the segment 180 // FIXME handle type parameters on the segment
179 Ty::Projection(ProjectionTy { 181 Ty::Projection(ProjectionTy {
180 associated_ty: associated_ty.id, 182 associated_ty,
181 parameters: trait_ref.substs, 183 parameters: trait_ref.substs,
182 }) 184 })
183 } 185 }
@@ -508,10 +510,11 @@ fn assoc_type_bindings_from_type_bound<'a>(
508 .flat_map(|args_and_bindings| args_and_bindings.bindings.iter()) 510 .flat_map(|args_and_bindings| args_and_bindings.bindings.iter())
509 .map(move |(name, type_ref)| { 511 .map(move |(name, type_ref)| {
510 let associated_ty = 512 let associated_ty =
511 match trait_ref.trait_.associated_type_by_name_including_super_traits(db, &name) { 513 associated_type_by_name_including_super_traits(db, trait_ref.trait_.id, &name);
512 None => return GenericPredicate::Error, 514 let associated_ty = match associated_ty {
513 Some(t) => t.id, 515 None => return GenericPredicate::Error,
514 }; 516 Some(t) => t,
517 };
515 let projection_ty = 518 let projection_ty =
516 ProjectionTy { associated_ty, parameters: trait_ref.substs.clone() }; 519 ProjectionTy { associated_ty, parameters: trait_ref.substs.clone() };
517 let ty = Ty::from_hir(db, resolver, type_ref); 520 let ty = Ty::from_hir(db, resolver, type_ref);