Rename `BoundTy` field `level` -> `index`

This commit is contained in:
scalexm 2018-10-23 16:28:53 +02:00
parent 3dd303aa89
commit ee569c796d
4 changed files with 9 additions and 9 deletions

View File

@ -117,7 +117,7 @@ impl FlagComputation {
&ty::Bound(bound_ty) => {
self.add_flags(TypeFlags::HAS_CANONICAL_VARS);
self.add_binder(bound_ty.level);
self.add_binder(bound_ty.index);
}
&ty::Infer(infer) => {

View File

@ -655,11 +655,11 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Shifter<'a, 'gcx, 'tcx> {
fn fold_ty(&mut self, ty: ty::Ty<'tcx>) -> ty::Ty<'tcx> {
match ty.sty {
ty::Bound(bound_ty) => {
if self.amount == 0 || bound_ty.level < self.current_index {
if self.amount == 0 || bound_ty.index < self.current_index {
ty
} else {
let shifted = ty::BoundTy {
level: bound_ty.level.shifted_in(self.amount),
index: bound_ty.index.shifted_in(self.amount),
var: bound_ty.var,
kind: bound_ty.kind,
};

View File

@ -1230,7 +1230,7 @@ newtype_index! {
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
pub struct BoundTy {
pub level: DebruijnIndex,
pub index: DebruijnIndex,
pub var: BoundVar,
pub kind: BoundTyKind,
}
@ -1241,13 +1241,13 @@ pub enum BoundTyKind {
Param(InternedString),
}
impl_stable_hash_for!(struct BoundTy { level, var, kind });
impl_stable_hash_for!(struct BoundTy { index, var, kind });
impl_stable_hash_for!(enum self::BoundTyKind { Anon, Param(a) });
impl BoundTy {
pub fn new(level: DebruijnIndex, var: BoundVar) -> Self {
pub fn new(index: DebruijnIndex, var: BoundVar) -> Self {
BoundTy {
level,
index,
var,
kind: BoundTyKind::Anon,
}

View File

@ -1120,10 +1120,10 @@ define_print! {
Bound(bound_ty) => {
match bound_ty.kind {
ty::BoundTyKind::Anon => {
if bound_ty.level == ty::INNERMOST {
if bound_ty.index == ty::INNERMOST {
write!(f, "?{}", bound_ty.var.index())
} else {
write!(f, "?{}_{}", bound_ty.level.index(), bound_ty.var.index())
write!(f, "?{}_{}", bound_ty.index.index(), bound_ty.var.index())
}
}