julia> Base.infer_effects(getindex, (UnitRange{Int}, Int))
(+c,+e,!n,+t,+s,+m,+u)
julia> Base.infer_effects(getindex, (Base.OneTo{Int}, Int))
(!c,+e,!n,+t,+s,+m,+u)
julia> VERSION
v"1.12.0-DEV.88"
Firstly, why is the inbounds effect not displayed (there are seven flags, not eight), even though the documentation says that this should be there? Secondly, why is the consistent
flag different between the two? Indexing a Base.OneTo
is a simpler operation, so I would have naively expected the flag to hold as well. I noticed that the (it doesn’t)getindex
for a UnitRange{Int}
with an Int
index uses val % T
instead of convert(T, val)
, so is this what is leading to the difference? These should both be no-ops, so I don’t see why this difference should matter.