diff --git a/Project.toml b/Project.toml index b16a767..92f5a9b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DiskArrays" uuid = "3c3547ce-8d99-4f5e-a174-61eb10b00ae3" authors = ["Fabian Gans "] -version = "0.4.19" +version = "0.4.20" [deps] ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9" diff --git a/src/iterator.jl b/src/iterator.jl index 1281faa..296c160 100644 --- a/src/iterator.jl +++ b/src/iterator.jl @@ -91,6 +91,8 @@ end end end end +_iterate_disk(a::AbstractArray{<:Any,0}, i=1) = i == 1 ? (@inbounds a[i], 2) : nothing + @noinline function _iterate_disk(a) # Get the indices for each chunk of data blockinds = BlockedIndices(eachchunk(a)) diff --git a/test/runtests.jl b/test/runtests.jl index 73d9068..483f189 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -379,6 +379,15 @@ end end end +# https://github.com/JuliaIO/DiskArrays.jl/issues/289 +@testset "iteration works for 0-dimensional arrays" begin + a = UnchunkedDiskArray(fill(42)) + @test iterate(a) == (42, 2) + @test iterate(a, 1) == (42, 2) + @test iterate(a, 2) === nothing + @test collect(a) == fill(42) +end + @testset "Views" begin a = AccessCountDiskArray(zeros(Int, 4, 5, 1)) test_view(a)