@@ -75,11 +75,10 @@ known_step(::Type{<:AbstractUnitRange{T}}) where {T} = one(T)
7575"""
7676 OptionallyStaticUnitRange(start, stop) <: AbstractUnitRange{Int}
7777
78- This range permits diverse representations of arrays to communicate common information
79- about their indices. Each field may be an integer or `Val(<:Integer)` if it is known
80- at compile time. An `OptionallyStaticUnitRange` is intended to be constructed internally
81- from other valid indices. Therefore, users should not expect the same checks are used
82- to ensure construction of a valid `OptionallyStaticUnitRange` as a `UnitRange`.
78+ Similar to `UnitRange` except each field may be an `Int` or `StaticInt`. An
79+ `OptionallyStaticUnitRange` is intended to be constructed internally from other valid
80+ indices. Therefore, users should not expect the same checks are used to ensure construction
81+ of a valid `OptionallyStaticUnitRange` as a `UnitRange`.
8382"""
8483struct OptionallyStaticUnitRange{F<: CanonicalInt ,L<: CanonicalInt } <: AbstractUnitRange{Int}
8584 start:: F
@@ -140,13 +139,14 @@ the range operator (i.e., `:`).
140139```julia
141140julia> using ArrayInterface
142141
143- julia> x = ArrayInterface.StaticInt (2);
142+ julia> x = ArrayInterface.static (2);
144143
145144julia> x:x:10
146- ArrayInterface.StaticInt{2}():ArrayInterface.StaticInt{2}( ):10
145+ static(2):static(2 ):10
147146
148147julia> ArrayInterface.OptionallyStaticStepRange(x, x, 10)
149- ArrayInterface.StaticInt{2}():ArrayInterface.StaticInt{2}():10
148+ static(2):static(2):10
149+
150150```
151151"""
152152struct OptionallyStaticStepRange{F<: CanonicalInt ,S<: CanonicalInt ,L<: CanonicalInt } <: OrdinalRange{Int,Int}
@@ -422,16 +422,16 @@ function Base.reverse(r::OptionallyStaticStepRange)
422422 return OptionallyStaticStepRange (static_last (r), - static_step (r), static_first (r))
423423end
424424
425- function Base. show (io:: IO , r:: OptionallyStaticRange )
426- print (io, first (r))
425+ function Base. show (io:: IO , :: MIME"text/plain" , r:: OptionallyStaticRange )
426+ print (io, static_first (r))
427427 if known_step (r) === 1
428428 print (io, " :" )
429429 else
430430 print (io, " :" )
431- print (io, step (r))
431+ print (io, static_step (r))
432432 print (io, " :" )
433433 end
434- print (io, last (r))
434+ print (io, static_last (r))
435435end
436436
437437"""
@@ -501,40 +501,40 @@ n = 16
501501
502502More importantly, `reduce_tup(_pick_range, inds)` often performs better than `reduce(_pick_range, inds)`.
503503```julia
504- julia> using ArrayInterface, BenchmarkTools
504+ julia> using ArrayInterface, BenchmarkTools, Static
505505
506- julia> inds = (Base.OneTo(100), 1:100, 1:ArrayInterface.StaticInt (100))
507- (Base.OneTo(100), 1:100, 1:Static (100))
506+ julia> inds = (Base.OneTo(100), 1:100, 1:static (100))
507+ (Base.OneTo(100), 1:100, 1:static (100))
508508
509509julia> @btime reduce(ArrayInterface._pick_range, \$ (Ref(inds))[])
510510 6.405 ns (0 allocations: 0 bytes)
511- Base.Slice(Static (1):Static (100))
511+ Base.Slice(static (1):static (100))
512512
513513julia> @btime ArrayInterface.reduce_tup(ArrayInterface._pick_range, \$ (Ref(inds))[])
514514 2.570 ns (0 allocations: 0 bytes)
515- Base.Slice(Static (1):Static (100))
515+ Base.Slice(static (1):static (100))
516516
517517julia> inds = (Base.OneTo(100), 1:100, 1:UInt(100))
518518(Base.OneTo(100), 1:100, 0x0000000000000001:0x0000000000000064)
519519
520520julia> @btime reduce(ArrayInterface._pick_range, \$ (Ref(inds))[])
521521 6.411 ns (0 allocations: 0 bytes)
522- Base.Slice(Static (1):100)
522+ Base.Slice(static (1):100)
523523
524524julia> @btime ArrayInterface.reduce_tup(ArrayInterface._pick_range, \$ (Ref(inds))[])
525525 2.592 ns (0 allocations: 0 bytes)
526- Base.Slice(Static (1):100)
526+ Base.Slice(static (1):100)
527527
528528julia> inds = (Base.OneTo(100), 1:100, 1:UInt(100), Int32(1):Int32(100))
529529(Base.OneTo(100), 1:100, 0x0000000000000001:0x0000000000000064, 1:100)
530530
531531julia> @btime reduce(ArrayInterface._pick_range, \$ (Ref(inds))[])
532532 9.048 ns (0 allocations: 0 bytes)
533- Base.Slice(Static (1):100)
533+ Base.Slice(static (1):100)
534534
535535julia> @btime ArrayInterface.reduce_tup(ArrayInterface._pick_range, \$ (Ref(inds))[])
536536 2.569 ns (0 allocations: 0 bytes)
537- Base.Slice(Static (1):100)
537+ Base.Slice(static (1):100)
538538```
539539"""
540540@generated function reduce_tup (f:: F , inds:: Tuple{Vararg{Any,N}} ) where {F,N}
0 commit comments