From a324d066cb767876f9f3398f83db9f5a8dda8ce4 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 14 Feb 2020 14:44:00 +0100 Subject: Rename Ty::Param => Ty::Placeholder This aligns more with Chalk. --- crates/ra_hir_ty/src/lib.rs | 10 +++++----- crates/ra_hir_ty/src/lower.rs | 8 ++++---- crates/ra_hir_ty/src/traits/chalk.rs | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index c5fe18c85..69ad13952 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs @@ -291,7 +291,7 @@ pub enum Ty { /// {}` when we're type-checking the body of that function. In this /// situation, we know this stands for *some* type, but don't know the exact /// type. - Param(TypeParamId), + Placeholder(TypeParamId), /// A bound type variable. This is used in various places: when representing /// some polymorphic type like the type of function `fn f`, the type @@ -365,7 +365,7 @@ impl Substs { /// Return Substs that replace each parameter by itself (i.e. `Ty::Param`). pub(crate) fn type_params_for_generics(generic_params: &Generics) -> Substs { - Substs(generic_params.iter().map(|(id, _)| Ty::Param(id)).collect()) + Substs(generic_params.iter().map(|(id, _)| Ty::Placeholder(id)).collect()) } /// Return Substs that replace each parameter by itself (i.e. `Ty::Param`). @@ -813,7 +813,7 @@ impl TypeWalk for Ty { p.walk(f); } } - Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {} + Ty::Placeholder { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {} } f(self); } @@ -831,7 +831,7 @@ impl TypeWalk for Ty { p.walk_mut_binders(f, binders + 1); } } - Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {} + Ty::Placeholder { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {} } f(self, binders); } @@ -1032,7 +1032,7 @@ impl HirDisplay for Ty { match self { Ty::Apply(a_ty) => a_ty.hir_fmt(f)?, Ty::Projection(p_ty) => p_ty.hir_fmt(f)?, - Ty::Param(id) => { + Ty::Placeholder(id) => { let generics = generics(f.db, id.parent); let param_data = &generics.params.types[id.local_id]; match param_data.provenance { diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs index c68c5852b..df24c16a3 100644 --- a/crates/ra_hir_ty/src/lower.rs +++ b/crates/ra_hir_ty/src/lower.rs @@ -152,7 +152,7 @@ impl Ty { data.provenance == TypeParamProvenance::ArgumentImplTrait }) .nth(idx as usize) - .map_or(Ty::Unknown, |(id, _)| Ty::Param(id)); + .map_or(Ty::Unknown, |(id, _)| Ty::Placeholder(id)); param } else { Ty::Unknown @@ -270,7 +270,7 @@ impl Ty { let generics = generics(ctx.db, ctx.resolver.generic_def().expect("generics in scope")); match ctx.type_param_mode { - TypeParamLoweringMode::Placeholder => Ty::Param(param_id), + TypeParamLoweringMode::Placeholder => Ty::Placeholder(param_id), TypeParamLoweringMode::Variable => { let idx = generics.param_idx(param_id).expect("matching generics"); Ty::Bound(idx) @@ -339,7 +339,7 @@ impl Ty { None => return Ty::Unknown, // this can't actually happen }; let param_id = match self_ty { - Ty::Param(id) if ctx.type_param_mode == TypeParamLoweringMode::Placeholder => id, + Ty::Placeholder(id) if ctx.type_param_mode == TypeParamLoweringMode::Placeholder => id, Ty::Bound(idx) if ctx.type_param_mode == TypeParamLoweringMode::Variable => { let generics = generics(ctx.db, def); let param_id = if let Some((id, _)) = generics.iter().nth(idx as usize) { @@ -544,7 +544,7 @@ impl GenericPredicate { let generics = generics(ctx.db, generic_def); let param_id = hir_def::TypeParamId { parent: generic_def, local_id: *param_id }; match ctx.type_param_mode { - TypeParamLoweringMode::Placeholder => Ty::Param(param_id), + TypeParamLoweringMode::Placeholder => Ty::Placeholder(param_id), TypeParamLoweringMode::Variable => { let idx = generics.param_idx(param_id).expect("matching generics"); Ty::Bound(idx) diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 4974c565b..882160fa8 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs @@ -142,7 +142,7 @@ impl ToChalk for Ty { let substitution = proj_ty.parameters.to_chalk(db); chalk_ir::AliasTy { associated_ty_id, substitution }.cast().intern() } - Ty::Param(id) => { + Ty::Placeholder(id) => { let interned_id = db.intern_type_param_id(id); PlaceholderIndex { ui: UniverseIndex::ROOT, @@ -184,7 +184,7 @@ impl ToChalk for Ty { let interned_id = crate::db::GlobalTypeParamId::from_intern_id( crate::salsa::InternId::from(idx.idx), ); - Ty::Param(db.lookup_intern_type_param_id(interned_id)) + Ty::Placeholder(db.lookup_intern_type_param_id(interned_id)) } chalk_ir::TyData::Alias(proj) => { let associated_ty = from_chalk(db, proj.associated_ty_id); -- cgit v1.2.3