Skip to content

Commit 6c9aaeb

Browse files
committed
Ensure ArrayInterfaceCore.known_first is being used
1 parent 621286f commit 6c9aaeb

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/axes.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ Base.IndexStyle(::Type{T}) where {T<:LazyAxis} = IndexStyle(parent_type(T))
191191

192192
can_change_size(::Type{LazyAxis{N,P}}) where {N,P} = can_change_size(P)
193193

194-
known_first(::Type{LazyAxis{N,P}}) where {N,P} = known_offsets(P, static(N))
195-
known_first(::Type{LazyAxis{:,P}}) where {P} = 1
194+
ArrayInterfaceCore.known_first(::Type{LazyAxis{N,P}}) where {N,P} = known_offsets(P, static(N))
195+
ArrayInterfaceCore.known_first(::Type{LazyAxis{:,P}}) where {P} = 1
196196
Base.firstindex(x::LazyAxis) = first(x)
197197
@inline function Base.first(x::LazyAxis{N})::Int where {N}
198-
if known_first(x) === nothing
198+
if ArrayInterfaceCore.known_first(x) === nothing
199199
return Int(offsets(parent(x), static(N)))
200200
else
201201
return Int(known_first(x))
@@ -208,8 +208,8 @@ end
208208
return known_first(x)
209209
end
210210
end
211-
known_last(::Type{LazyAxis{N,P}}) where {N,P} = known_last(axes_types(P, static(N)))
212-
known_last(::Type{LazyAxis{:,P}}) where {P} = known_length(P)
211+
ArrayInterfaceCore.known_last(::Type{LazyAxis{N,P}}) where {N,P} = known_last(axes_types(P, static(N)))
212+
ArrayInterfaceCore.known_last(::Type{LazyAxis{:,P}}) where {P} = known_length(P)
213213
Base.lastindex(x::LazyAxis) = last(x)
214214
Base.last(x::LazyAxis) = _last(known_last(x), x)
215215
_last(::Nothing, x) = last(parent(x))

src/ranges.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ SOneTo(n::Int) = SOneTo{n}()
124124
const OptionallyStaticRange = Union{<:OptionallyStaticUnitRange,<:OptionallyStaticStepRange}
125125

126126

127-
known_first(::Type{<:OptionallyStaticUnitRange{StaticInt{F}}}) where {F} = F::Int
128-
known_first(::Type{<:OptionallyStaticStepRange{StaticInt{F}}}) where {F} = F::Int
127+
ArrayInterfaceCore.known_first(::Type{<:OptionallyStaticUnitRange{StaticInt{F}}}) where {F} = F::Int
128+
ArrayInterfaceCore.known_first(::Type{<:OptionallyStaticStepRange{StaticInt{F}}}) where {F} = F::Int
129129

130-
known_step(::Type{<:OptionallyStaticStepRange{<:Any,StaticInt{S}}}) where {S} = S::Int
130+
ArrayInterfaceCore.known_step(::Type{<:OptionallyStaticStepRange{<:Any,StaticInt{S}}}) where {S} = S::Int
131131

132-
known_last(::Type{<:OptionallyStaticUnitRange{<:Any,StaticInt{L}}}) where {L} = L::Int
133-
known_last(::Type{<:OptionallyStaticStepRange{<:Any,<:Any,StaticInt{L}}}) where {L} = L::Int
132+
ArrayInterfaceCore.known_last(::Type{<:OptionallyStaticUnitRange{<:Any,StaticInt{L}}}) where {L} = L::Int
133+
ArrayInterfaceCore.known_last(::Type{<:OptionallyStaticStepRange{<:Any,<:Any,StaticInt{L}}}) where {L} = L::Int
134134

135135
@inline function Base.first(r::OptionallyStaticRange)::Int
136136
if known_first(r) === nothing

0 commit comments

Comments
 (0)