Skip to content

Commit 9b955ad

Browse files
committed
Have OptionallyStaticRanges iterate using Ints for type stability.
1 parent 788f44e commit 9b955ad

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ArrayInterface"
22
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
3-
version = "2.14.5"
3+
version = "2.14.6"
44

55
[deps]
66
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/ranges.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ end
373373
const OptionallyStaticRange = Union{<:OptionallyStaticUnitRange,<:OptionallyStaticStepRange}
374374

375375
Base.eachindex(r::OptionallyStaticRange) = r
376+
@inline Base.iterate(r::OptionallyStaticRange) = (fi = Int(first(r)); (fi,fi))
377+
376378

377379
Base.to_shape(x::OptionallyStaticRange) = length(x)
378380
Base.to_shape(x::Slice{T}) where {T<:OptionallyStaticRange} = length(x)

0 commit comments

Comments
 (0)