fn foo(x: fn(&T), y: &U)
fn foo
x / \ y
fn &
| |
& U
|
T
In the case of the &T
type that is part of x
, debruijn index of 1 refers to the fn, and 2 refers to the fn foo
.
In the case of the &U
type that is part of y
, debruijn index of 1 refers to the fn foo
.
general rule: debruijn index goes upwards in the tree, stopping at each fn
(or other place where regions can be bound -- typically functions).