diff --git a/Project.toml b/Project.toml index c0b801fb..10afd1ec 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "RecursiveArrayTools" uuid = "731186ca-8d62-57ce-b412-fbd966d074cd" authors = ["Chris Rackauckas "] -version = "3.27.2" +version = "3.27.3" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/vector_of_array.jl b/src/vector_of_array.jl index 95a2a930..fc2fce0b 100644 --- a/src/vector_of_array.jl +++ b/src/vector_of_array.jl @@ -521,7 +521,7 @@ end function Base.zero(VA::AbstractVectorOfArray) val = copy(VA) - val.u = zero.(VA.u) + val.u .= zero.(VA.u) return val end diff --git a/test/interface_tests.jl b/test/interface_tests.jl index f370e21d..a1266082 100644 --- a/test/interface_tests.jl +++ b/test/interface_tests.jl @@ -269,3 +269,13 @@ end f3!(z, zz) @test z == VectorOfArray([fill(4, SVector{2, Float64}), fill(2, SVector{2, Float64})]) @test (@allocated f3!(z, zz)) == 0 + +struct ImmutableVectorOfArray{T, N, A} <: AbstractVectorOfArray{T, N, A} + u::A # A <: AbstractArray{<: AbstractArray{T, N - 1}} +end + +@testset "Base.zero does not assume mutable struct" begin + voa = ImmutableVectorOfArray{Float64, 2, Vector{Vector{Float64}}}([ones(3), 2ones(3)]) + zvoa = zero(voa) + @test zvoa.u[1] == zvoa.u[2] == zeros(3) +end diff --git a/test/linalg.jl b/test/linalg.jl index 23fedffb..33a8c4ec 100644 --- a/test/linalg.jl +++ b/test/linalg.jl @@ -56,4 +56,4 @@ mat = Array(va) @test all(va'[i] == mat'[i] for i in eachindex(mat')) @test Array(va') == mat' -@test !ArrayInterface.issingular(VectorOfArray([rand(2),rand(2)])) +@test !ArrayInterface.issingular(VectorOfArray([rand(2), rand(2)])) diff --git a/test/partitions_test.jl b/test/partitions_test.jl index 2625941e..d444a4ff 100644 --- a/test/partitions_test.jl +++ b/test/partitions_test.jl @@ -161,7 +161,6 @@ _scalar_op(y) = y + 1 _broadcast_wrapper(y) = _scalar_op.(y) # Issue #8 @inferred _broadcast_wrapper(x) -@test_broken @inferred _broadcast_wrapper(y) # Testing map @test map(x -> x^2, x) == ArrayPartition(x.x[1] .^ 2, x.x[2] .^ 2)