We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8ee3f6 commit b18a5f3Copy full SHA for b18a5f3
src/ArrayInterface.jl
@@ -36,6 +36,7 @@ known_length(x) = known_length(typeof(x))
36
known_length(::Type{<:NTuple{N,<:Any}}) where {N} = N
37
known_length(::Type{<:NamedTuple{L}}) where {L} = length(L)
38
known_length(::Type{T}) where {T<:Base.Slice} = known_length(parent_type(T))
39
+known_length(::Type{T}) where {T} = false
40
41
"""
42
can_change_size(::Type{T}) -> Bool
test/runtests.jl
@@ -204,6 +204,7 @@ end
204
@test ArrayInterface.known_length(1:2) == nothing
205
@test ArrayInterface.known_length((1,)) == 1
206
@test ArrayInterface.known_length((a=1,b=2)) == 2
207
+ @test ArrayInterface.known_length([]) == nothing
208
end
209
210
@testset "indices" begin
0 commit comments