File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -500,8 +500,10 @@ Otherwise, return `nothing`.
500500@test isnothing(known_first(typeof(1:4)))
501501@test isone(known_first(typeof(Base.OneTo(4))))
502502"""
503- known_first (:: Any ) = nothing
503+ known_first (x) = known_first (typeof (x))
504+ known_first (:: Type{T} ) where {T} = nothing
504505known_first (:: Type{Base.OneTo{T}} ) where {T} = one (T)
506+
505507"""
506508known_last(::Type{T})
507509
@@ -512,7 +514,9 @@ Otherwise, return `nothing`.
512514using StaticArrays
513515@test known_last(typeof(SOneTo(4))) == 4
514516"""
515- known_last (:: Any ) = nothing
517+ known_last (x) = known_last (typeof (x))
518+ known_last (:: Type{T} ) where {T} = nothing
519+
516520"""
517521known_step(::Type{T})
518522
@@ -522,7 +526,8 @@ Otherwise, return `nothing`.
522526@test isnothing(known_step(typeof(1:0.2:4)))
523527@test isone(known_step(typeof(1:4)))
524528"""
525- known_step (:: Any ) = nothing
529+ known_step (x) = known_step (typeof (x))
530+ known_step (:: Type{T} ) where {T} = nothing
526531known_step (:: Type{<:AbstractUnitRange{T}} ) where {T} = one (T)
527532
528533function __init__ ()
Original file line number Diff line number Diff line change @@ -177,11 +177,14 @@ end
177177
178178@testset " Range Interface" begin
179179 @test isnothing (ArrayInterface. known_first (typeof (1 : 4 )))
180+ @test isone (ArrayInterface. known_first (Base. OneTo (4 )))
180181 @test isone (ArrayInterface. known_first (typeof (Base. OneTo (4 ))))
181-
182+
183+ @test isnothing (ArrayInterface. known_last (1 : 4 ))
182184 @test isnothing (ArrayInterface. known_last (typeof (1 : 4 )))
183185
184186 @test isnothing (ArrayInterface. known_step (typeof (1 : 0.2 : 4 )))
187+ @test isone (ArrayInterface. known_step (1 : 4 ))
185188 @test isone (ArrayInterface. known_step (typeof (1 : 4 )))
186189end
187190
You can’t perform that action at this time.
0 commit comments