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 @@ pub trait TypeWalk {
where where
Self: Sized, Self: Sized,
{ {
self.fold(&mut |ty| match ty { self.fold_binders(&mut |ty, binders| match ty {
Ty::Bound(idx) => { Ty::Bound(idx) if idx as usize >= binders => {
assert!(idx as i32 >= -n); assert!(idx as i32 >= -n);
Ty::Bound((idx as i32 + n) as u32) Ty::Bound((idx as i32 + n) as u32)
} }
ty => ty, ty => ty,
}) }, 0)
} }
} }