diff --git a/Project.toml b/Project.toml index a3a4f981..ad31d0fc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "LazyArrays" uuid = "5078a376-72f3-5289-bfd5-ec5146d43c02" -version = "0.14.9" +version = "0.14.10" [deps] diff --git a/src/lazyapplying.jl b/src/lazyapplying.jl index 0bb9ce84..344beba4 100644 --- a/src/lazyapplying.jl +++ b/src/lazyapplying.jl @@ -184,7 +184,7 @@ AbstractArray{T,N}(A::ApplyArray{<:Any,N}) where {T,N} = ApplyArray{T,N}(A.f, ma @inline axes(A::ApplyArray) = axes(Applied(A)) @inline size(A::ApplyArray) = map(length, axes(A)) -@inline copy(A::ApplyArray) = ApplyArray(A.f, map(copy,A.args)...) +@inline copy(A::ApplyArray{T,N}) where {T,N} = ApplyArray{T,N}(A.f, map(copy,A.args)...) struct LazyArrayApplyStyle <: AbstractArrayApplyStyle end @@ -305,4 +305,4 @@ getindex(A::ApplyMatrix{T,typeof(triu),<:Tuple{<:AbstractMatrix,<:Integer}}, k:: replace_in_print_matrix(A::ApplyMatrix{<:Any,typeof(triu),<:Tuple{<:AbstractMatrix}}, i::Integer, j::Integer, s::AbstractString) = j ≥ i ? replace_in_print_matrix(A.args[1], i, j, s) : replace_with_centered_mark(s) replace_in_print_matrix(A::ApplyMatrix{<:Any,typeof(triu),<:Tuple{<:AbstractMatrix,<:Integer}}, i::Integer, j::Integer, s::AbstractString) = - j ≥ i+A.args[2] ? replace_in_print_matrix(A.args[1], i, j, s) : replace_with_centered_mark(s) \ No newline at end of file + j ≥ i+A.args[2] ? replace_in_print_matrix(A.args[1], i, j, s) : replace_with_centered_mark(s) diff --git a/test/applytests.jl b/test/applytests.jl index 6d3d7a71..0f165d07 100644 --- a/test/applytests.jl +++ b/test/applytests.jl @@ -40,3 +40,12 @@ end @test M isa ApplyArray @test M == exp(A) end + +@testset "copy (#85)" begin + Base.size(A::Applied) = (length(A.args[1]),) + Base.eltype(A::Applied) = eltype(A.args[1]) + v = ApplyVector(vec, ones(Int, 2, 2)) + vc = copy(float.(v)) + ve = convert(Vector, vc) + @test eltype(ve) == Float64 +end