Skip to content

Commit 9126b0f

Browse files
committed
fix for firstindex(128:static(-1):1)
1 parent fedb318 commit 9126b0f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/ranges.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ known_step(::Type{<:OptionallyStaticStepRange{<:Any,StaticInt{S}}}) where {S} =
214214
known_last(::Type{<:OptionallyStaticUnitRange{<:Any,StaticInt{L}}}) where {L} = L::Int
215215
known_last(::Type{<:OptionallyStaticStepRange{<:Any,<:Any,StaticInt{L}}}) where {L} = L::Int
216216

217-
Base.firstindex(x::OptionallyStaticRange) = first(x)
218217
@inline function Base.first(r::OptionallyStaticRange)::Int
219218
if known_first(r) === nothing
220219
return getfield(r, :start)

test/ranges.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,7 @@
113113

114114
@test @inferred(eachindex(static(-7):static(7))) === static(1):static(15)
115115
@test @inferred((static(-7):static(7))[first(eachindex(static(-7):static(7)))]) == -7
116+
117+
@test @inferred(firstindex(128:static(-1):1)) == 1
116118
end
117119

0 commit comments

Comments
 (0)