Skip to content

Commit 5c84ad3

Browse files
committed
static_first, too
1 parent 5913ab0 commit 5c84ad3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/ranges.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function known_first(::Type{T}) where {T}
2424
return known_first(parent_type(T))
2525
end
2626
end
27-
known_first(::Type{Base.OneTo{T}}) where {T} = one(T)
27+
known_first(::Type{Base.OneTo{T}}) where {T} = 1
2828
function known_first(::Type{T}) where {N,R,T<:CartesianIndices{N,R}}
2929
_cartesian_index(ntuple(i -> known_first(R.parameters[i]), Val(N)))
3030
end

test/ranges.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
@test_throws BoundsError getindex(ArrayInterface.OptionallyStaticUnitRange(StaticInt(1), 10), 11)
103103
@test_throws BoundsError getindex(ArrayInterface.OptionallyStaticStepRange(StaticInt(1), 2, 10), 11)
104104

105+
@test ArrayInterface.static_first(Base.OneTo(one(UInt))) === static(1)
105106
@test ArrayInterface.static_step(Base.OneTo(one(UInt))) === static(1)
106107
end
107108

0 commit comments

Comments
 (0)