Rename Ty::Param => Ty::Placeholder
This aligns more with Chalk.
This commit is contained in:
parent
a19f52f9ae
commit
a324d066cb
@ -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<T>`, 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 {
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user