aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lower.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r--crates/hir_ty/src/lower.rs34
1 files changed, 27 insertions, 7 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index 7fd46becd..c99dd8d0a 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -414,17 +414,16 @@ impl<'a> TyLoweringContext<'a> {
414 self.lower_trait_ref_from_resolved_path(trait_, resolved_segment, self_ty); 414 self.lower_trait_ref_from_resolved_path(trait_, resolved_segment, self_ty);
415 let ty = if remaining_segments.len() == 1 { 415 let ty = if remaining_segments.len() == 1 {
416 let segment = remaining_segments.first().unwrap(); 416 let segment = remaining_segments.first().unwrap();
417 let found = associated_type_by_name_including_super_traits( 417 let found = self
418 self.db, 418 .db
419 trait_ref, 419 .trait_data(trait_ref.hir_trait_id())
420 &segment.name, 420 .associated_type_by_name(&segment.name);
421 );
422 match found { 421 match found {
423 Some((super_trait_ref, associated_ty)) => { 422 Some(associated_ty) => {
424 // FIXME handle type parameters on the segment 423 // FIXME handle type parameters on the segment
425 TyKind::Alias(AliasTy::Projection(ProjectionTy { 424 TyKind::Alias(AliasTy::Projection(ProjectionTy {
426 associated_ty_id: to_assoc_type_id(associated_ty), 425 associated_ty_id: to_assoc_type_id(associated_ty),
427 substitution: super_trait_ref.substitution, 426 substitution: trait_ref.substitution,
428 })) 427 }))
429 .intern(&Interner) 428 .intern(&Interner)
430 } 429 }
@@ -1089,6 +1088,27 @@ pub(crate) fn generic_defaults_query(
1089 defaults 1088 defaults
1090} 1089}
1091 1090
1091pub(crate) fn generic_defaults_recover(
1092 db: &dyn HirDatabase,
1093 _cycle: &[String],
1094 def: &GenericDefId,
1095) -> Arc<[Binders<Ty>]> {
1096 let generic_params = generics(db.upcast(), *def);
1097
1098 // we still need one default per parameter
1099 let defaults = generic_params
1100 .iter()
1101 .enumerate()
1102 .map(|(idx, _)| {
1103 let ty = TyKind::Error.intern(&Interner);
1104
1105 crate::make_only_type_binders(idx, ty)
1106 })
1107 .collect();
1108
1109 defaults
1110}
1111
1092fn fn_sig_for_fn(db: &dyn HirDatabase, def: FunctionId) -> PolyFnSig { 1112fn fn_sig_for_fn(db: &dyn HirDatabase, def: FunctionId) -> PolyFnSig {
1093 let data = db.function_data(def); 1113 let data = db.function_data(def);
1094 let resolver = def.resolver(db.upcast()); 1114 let resolver = def.resolver(db.upcast());