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`.
500
500
@test isnothing(known_first(typeof(1:4)))
501
501
@test isone(known_first(typeof(Base.OneTo(4))))
502
502
"""
503
- known_first (:: Any ) = nothing
503
+ known_first (x) = known_first (typeof (x))
504
+ known_first (:: Type{T} ) where {T} = nothing
504
505
known_first (:: Type{Base.OneTo{T}} ) where {T} = one (T)
506
+
505
507
"""
506
508
known_last(::Type{T})
507
509
@@ -512,7 +514,9 @@ Otherwise, return `nothing`.
512
514
using StaticArrays
513
515
@test known_last(typeof(SOneTo(4))) == 4
514
516
"""
515
- known_last (:: Any ) = nothing
517
+ known_last (x) = known_last (typeof (x))
518
+ known_last (:: Type{T} ) where {T} = nothing
519
+
516
520
"""
517
521
known_step(::Type{T})
518
522
@@ -522,7 +526,8 @@ Otherwise, return `nothing`.
522
526
@test isnothing(known_step(typeof(1:0.2:4)))
523
527
@test isone(known_step(typeof(1:4)))
524
528
"""
525
- known_step (:: Any ) = nothing
529
+ known_step (x) = known_step (typeof (x))
530
+ known_step (:: Type{T} ) where {T} = nothing
526
531
known_step (:: Type{<:AbstractUnitRange{T}} ) where {T} = one (T)
527
532
528
533
function __init__ ()
Original file line number Diff line number Diff line change @@ -177,11 +177,14 @@ end
177
177
178
178
@testset " Range Interface" begin
179
179
@test isnothing (ArrayInterface. known_first (typeof (1 : 4 )))
180
+ @test isone (ArrayInterface. known_first (Base. OneTo (4 )))
180
181
@test isone (ArrayInterface. known_first (typeof (Base. OneTo (4 ))))
181
-
182
+
183
+ @test isnothing (ArrayInterface. known_last (1 : 4 ))
182
184
@test isnothing (ArrayInterface. known_last (typeof (1 : 4 )))
183
185
184
186
@test isnothing (ArrayInterface. known_step (typeof (1 : 0.2 : 4 )))
187
+ @test isone (ArrayInterface. known_step (1 : 4 ))
185
188
@test isone (ArrayInterface. known_step (typeof (1 : 4 )))
186
189
end
187
190
You can’t perform that action at this time.
0 commit comments