|
279 | 279 |
|
280 | 280 | @test isnothing(@inferred(ArrayInterface.known_first(typeof(1:4)))) |
281 | 281 | @test isone(@inferred(ArrayInterface.known_first(Base.OneTo(4)))) |
| 282 | + @test isone(@inferred(ArrayInterface.known_first(Base.IdentityUnitRange(Base.OneTo(4))))) |
| 283 | + @test isone(@inferred(ArrayInterface.known_first(LinearIndices((1, 1, 1))))) |
282 | 284 | @test isone(@inferred(ArrayInterface.known_first(typeof(Base.OneTo(4))))) |
283 | 285 | @test @inferred(ArrayInterface.known_first(typeof(CI))) == CartesianIndex(1, 1) |
284 | 286 | @test @inferred(ArrayInterface.known_first(typeof(CI))) == CartesianIndex(1, 1) |
|
303 | 305 | A2r = reinterpret(ComplexF64, A2) |
304 | 306 |
|
305 | 307 | @test @inferred(ArrayInterface.known_size(1)) === () |
| 308 | + @test @inferred(ArrayInterface.known_size([1, 1]')) === (1, nothing) |
| 309 | + @test @inferred(ArrayInterface.known_size(view([1, 1]', :, 1))) === (1, ) |
| 310 | + @test @inferred(ArrayInterface.known_size(Diagonal(view([1, 1]', :, 1)))) === (1, 1) |
306 | 311 | @test @inferred(ArrayInterface.known_size(view(rand(4), reshape(1:4, 2, 2)))) == (nothing, nothing) |
307 | 312 | @test @inferred(ArrayInterface.known_size(A)) === (nothing, nothing, nothing) |
308 | 313 | @test @inferred(ArrayInterface.known_size(Ap)) === (nothing, nothing) |
|
311 | 316 | @test ArrayInterface.known_size(Ar, 4) === 1 |
312 | 317 | @test @inferred(ArrayInterface.known_size(A2)) === (nothing, nothing, nothing) |
313 | 318 | @test @inferred(ArrayInterface.known_size(A2r)) === (nothing, nothing, nothing) |
| 319 | + |
| 320 | + @test @inferred(ArrayInterface.known_length(1)) === 1 |
| 321 | + @test @inferred(ArrayInterface.known_length(Base.Slice(1:2))) === nothing |
| 322 | + @test @inferred(ArrayInterface.known_length(CartesianIndex(1, 2, 3))) === 3 |
| 323 | + @test @inferred(ArrayInterface.known_length((x = 1, y = 2))) === 2 |
314 | 324 | end |
315 | 325 |
|
0 commit comments