diff options
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r-- | crates/hir_ty/src/lower.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index b8b1400eb..78a914cac 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
@@ -27,7 +27,7 @@ use stdx::impl_from; | |||
27 | 27 | ||
28 | use crate::{ | 28 | use crate::{ |
29 | db::HirDatabase, | 29 | db::HirDatabase, |
30 | to_assoc_type_id, | 30 | to_assoc_type_id, to_placeholder_idx, |
31 | traits::chalk::{Interner, ToChalk}, | 31 | traits::chalk::{Interner, ToChalk}, |
32 | utils::{ | 32 | utils::{ |
33 | all_super_trait_refs, associated_type_by_name_including_super_traits, generics, | 33 | all_super_trait_refs, associated_type_by_name_including_super_traits, generics, |
@@ -249,7 +249,9 @@ impl Ty { | |||
249 | data.provenance == TypeParamProvenance::ArgumentImplTrait | 249 | data.provenance == TypeParamProvenance::ArgumentImplTrait |
250 | }) | 250 | }) |
251 | .nth(idx as usize) | 251 | .nth(idx as usize) |
252 | .map_or(TyKind::Unknown, |(id, _)| TyKind::Placeholder(id)); | 252 | .map_or(TyKind::Unknown, |(id, _)| { |
253 | TyKind::Placeholder(to_placeholder_idx(ctx.db, id)) | ||
254 | }); | ||
253 | param.intern(&Interner) | 255 | param.intern(&Interner) |
254 | } else { | 256 | } else { |
255 | TyKind::Unknown.intern(&Interner) | 257 | TyKind::Unknown.intern(&Interner) |
@@ -384,7 +386,9 @@ impl Ty { | |||
384 | ctx.resolver.generic_def().expect("generics in scope"), | 386 | ctx.resolver.generic_def().expect("generics in scope"), |
385 | ); | 387 | ); |
386 | match ctx.type_param_mode { | 388 | match ctx.type_param_mode { |
387 | TypeParamLoweringMode::Placeholder => TyKind::Placeholder(param_id), | 389 | TypeParamLoweringMode::Placeholder => { |
390 | TyKind::Placeholder(to_placeholder_idx(ctx.db, param_id)) | ||
391 | } | ||
388 | TypeParamLoweringMode::Variable => { | 392 | TypeParamLoweringMode::Variable => { |
389 | let idx = generics.param_idx(param_id).expect("matching generics"); | 393 | let idx = generics.param_idx(param_id).expect("matching generics"); |
390 | TyKind::BoundVar(BoundVar::new(ctx.in_binders, idx)) | 394 | TyKind::BoundVar(BoundVar::new(ctx.in_binders, idx)) |
@@ -396,7 +400,7 @@ impl Ty { | |||
396 | let generics = generics(ctx.db.upcast(), impl_id.into()); | 400 | let generics = generics(ctx.db.upcast(), impl_id.into()); |
397 | let substs = match ctx.type_param_mode { | 401 | let substs = match ctx.type_param_mode { |
398 | TypeParamLoweringMode::Placeholder => { | 402 | TypeParamLoweringMode::Placeholder => { |
399 | Substs::type_params_for_generics(&generics) | 403 | Substs::type_params_for_generics(ctx.db, &generics) |
400 | } | 404 | } |
401 | TypeParamLoweringMode::Variable => { | 405 | TypeParamLoweringMode::Variable => { |
402 | Substs::bound_vars(&generics, ctx.in_binders) | 406 | Substs::bound_vars(&generics, ctx.in_binders) |
@@ -408,7 +412,7 @@ impl Ty { | |||
408 | let generics = generics(ctx.db.upcast(), adt.into()); | 412 | let generics = generics(ctx.db.upcast(), adt.into()); |
409 | let substs = match ctx.type_param_mode { | 413 | let substs = match ctx.type_param_mode { |
410 | TypeParamLoweringMode::Placeholder => { | 414 | TypeParamLoweringMode::Placeholder => { |
411 | Substs::type_params_for_generics(&generics) | 415 | Substs::type_params_for_generics(ctx.db, &generics) |
412 | } | 416 | } |
413 | TypeParamLoweringMode::Variable => { | 417 | TypeParamLoweringMode::Variable => { |
414 | Substs::bound_vars(&generics, ctx.in_binders) | 418 | Substs::bound_vars(&generics, ctx.in_binders) |
@@ -689,8 +693,9 @@ impl GenericPredicate { | |||
689 | let generics = generics(ctx.db.upcast(), generic_def); | 693 | let generics = generics(ctx.db.upcast(), generic_def); |
690 | let param_id = | 694 | let param_id = |
691 | hir_def::TypeParamId { parent: generic_def, local_id: *param_id }; | 695 | hir_def::TypeParamId { parent: generic_def, local_id: *param_id }; |
696 | let placeholder = to_placeholder_idx(ctx.db, param_id); | ||
692 | match ctx.type_param_mode { | 697 | match ctx.type_param_mode { |
693 | TypeParamLoweringMode::Placeholder => TyKind::Placeholder(param_id), | 698 | TypeParamLoweringMode::Placeholder => TyKind::Placeholder(placeholder), |
694 | TypeParamLoweringMode::Variable => { | 699 | TypeParamLoweringMode::Variable => { |
695 | let idx = generics.param_idx(param_id).expect("matching generics"); | 700 | let idx = generics.param_idx(param_id).expect("matching generics"); |
696 | TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, idx)) | 701 | TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, idx)) |