Skip to content

Commit bb56a11

Browse files
authored
Merge pull request #197 from JuliaArrays/uintstaticstep
Uint static step
2 parents b8fbb3b + 5c84ad3 commit bb56a11

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
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 = "3.1.28"
3+
version = "3.1.29"
44

55
[deps]
66
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"

src/ranges.jl

Lines changed: 2 additions & 2 deletions
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
@@ -80,7 +80,7 @@ function known_step(::Type{T}) where {T}
8080
return known_step(parent_type(T))
8181
end
8282
end
83-
known_step(::Type{<:AbstractUnitRange{T}}) where {T} = one(T)
83+
known_step(::Type{<:AbstractUnitRange}) = 1
8484

8585
"""
8686
OptionallyStaticUnitRange(start, stop) <: AbstractUnitRange{Int}

test/ranges.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,8 @@
101101
@test_throws BoundsError getindex(ArrayInterface.OptionallyStaticStepRange(StaticInt(1), 2, 10), 0)
102102
@test_throws BoundsError getindex(ArrayInterface.OptionallyStaticUnitRange(StaticInt(1), 10), 11)
103103
@test_throws BoundsError getindex(ArrayInterface.OptionallyStaticStepRange(StaticInt(1), 2, 10), 11)
104+
105+
@test ArrayInterface.static_first(Base.OneTo(one(UInt))) === static(1)
106+
@test ArrayInterface.static_step(Base.OneTo(one(UInt))) === static(1)
104107
end
105108

0 commit comments

Comments
 (0)