Skip to content

Commit 7261297

Browse files
committed
Add StaticArrays.SOneTo to known_last examples, to give an example of it doing something other than returning nothing.
1 parent 0bbfbe0 commit 7261297

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ returns `one(Int)`.
103103
## known_last(::Type{T})
104104

105105
If `last` of instances of type `T` are known at compile time, return that
106-
last element. Otherwise, return `nothing`.
106+
last element. Otherwise, return `nothing`. For example,
107+
`known_last(StaticArrays.SOneTo{4})` returns 4.
107108

108109
## known_step(::Type{T})
109110

src/ArrayInterface.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,8 @@ If `last` of an instance of type `T` is known at compile time, return it.
509509
Otherwise, return `nothing`.
510510
511511
@test isnothing(known_last(typeof(1:4)))
512+
using StaticArrays
513+
@test known_last(typeof(SOneTo(4))) == 4
512514
"""
513515
known_last(::Any) = nothing
514516
"""

0 commit comments

Comments
 (0)