Consider the following case:
struct A <: AbstractArray{Int, 2}
N::Int
end
struct B <: AbstractArray{Int, 2}
A::A
Func
end
...
@inline Base.getindex(A::A, i::Int, j::Int) = begin
@boundscheck (1 <= i <= A.N && 1 <= j <= A.N) || throw(BoundsError())
i - j
end
Base.@propagate_inbounds Base.getindex(B::B, i::Int, j::Int) = begin
B.Func(B.A[i, j])
end
Looking at the docs and some examples I was sure that the bounds checks would be eliminated while executing "@inbounds b[i, j]" (b is an array of type B). However, it is not the case. What am I missing?