Fix shift_bound_vars

It should only shift free vars (maybe the name isn't the best...)
This commit is contained in:
Florian Diebold 2020-02-21 23:07:29 +01:00
parent 463df6720c
commit c200025794

View File

@ -814,13 +814,13 @@ fn shift_bound_vars(self, n: i32) -> Self
where
Self: Sized,
{
self.fold(&mut |ty| match ty {
Ty::Bound(idx) => {
self.fold_binders(&mut |ty, binders| match ty {
Ty::Bound(idx) if idx as usize >= binders => {
assert!(idx as i32 >= -n);
Ty::Bound((idx as i32 + n) as u32)
}
ty => ty,
})
}, 0)
}
}