From c2f9558e1af8dbf73ff86eeffcb9ea6940947dd6 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 17 Sep 2019 23:11:20 +0200 Subject: Remove assoc type selection code for now to fix crashes --- crates/ra_hir/src/ty/lower.rs | 23 ++++------------------- crates/ra_hir/src/ty/tests.rs | 12 ++++++------ 2 files changed, 10 insertions(+), 25 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 35fdd4a37..a83842b0f 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs @@ -189,26 +189,11 @@ impl Ty { } fn select_associated_type( - db: &impl HirDatabase, - resolver: &Resolver, - self_ty: Ty, - segment: &PathSegment, + _db: &impl HirDatabase, + _resolver: &Resolver, + _self_ty: Ty, + _segment: &PathSegment, ) -> Ty { - let env = trait_env(db, resolver); - let traits_from_env = env.trait_predicates_for_self_ty(&self_ty).map(|tr| tr.trait_); - let traits = traits_from_env.flat_map(|t| t.all_super_traits(db)); - for t in traits { - if let Some(associated_ty) = t.associated_type_by_name(db, &segment.name) { - let generics = t.generic_params(db); - let mut substs = Vec::new(); - substs.push(self_ty.clone()); - substs.extend( - iter::repeat(Ty::Unknown).take(generics.count_params_including_parent() - 1), - ); - // FIXME handle type parameters on the segment - return Ty::Projection(ProjectionTy { associated_ty, parameters: substs.into() }); - } - } Ty::Unknown } diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 9a3faa9ab..09c17fdf4 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -2740,17 +2740,17 @@ fn test() { [202; 203) 't': T [221; 223) '{}': () [234; 300) '{ ...(S); }': () - [244; 245) 'x': u32 - [248; 252) 'foo1': fn foo1(T) -> ::Item - [248; 255) 'foo1(S)': u32 + [244; 245) 'x': {unknown} + [248; 252) 'foo1': fn foo1(T) -> {unknown} + [248; 255) 'foo1(S)': {unknown} [253; 254) 'S': S [265; 266) 'y': u32 [269; 273) 'foo2': fn foo2(T) -> ::Item [269; 276) 'foo2(S)': u32 [274; 275) 'S': S - [286; 287) 'z': u32 - [290; 294) 'foo3': fn foo3(T) -> ::Item - [290; 297) 'foo3(S)': u32 + [286; 287) 'z': {unknown} + [290; 294) 'foo3': fn foo3(T) -> {unknown} + [290; 297) 'foo3(S)': {unknown} [295; 296) 'S': S "### ); -- cgit v1.2.3