Skip to content

Commit 70886bb

Browse files
committed
fix static_step AbstractUnitRange{UInt}
1 parent 561848d commit 70886bb

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/ranges.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function known_step(::Type{T}) where {T}
7070
return known_step(parent_type(T))
7171
end
7272
end
73-
known_step(::Type{<:AbstractUnitRange{T}}) where {T} = one(T)
73+
known_step(::Type{<:AbstractUnitRange}) = 1
7474

7575
"""
7676
OptionallyStaticUnitRange(start, stop) <: AbstractUnitRange{Int}

test/ranges.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,7 @@
9292
@test_throws BoundsError getindex(ArrayInterface.OptionallyStaticStepRange(StaticInt(1), 2, 10), 0)
9393
@test_throws BoundsError getindex(ArrayInterface.OptionallyStaticUnitRange(StaticInt(1), 10), 11)
9494
@test_throws BoundsError getindex(ArrayInterface.OptionallyStaticStepRange(StaticInt(1), 2, 10), 11)
95+
96+
@test ArrayInterface.static_step(Base.OneTo(one(UInt))) === static(1)
9597
end
9698

0 commit comments

Comments
 (0)