Skip to content

Commit 7336bc5

Browse files
tlienartdlfivefifty
authored andcommitted
Fix for copy #85 (#86)
* Update lazyapplying.jl * Update applytests.jl * Update Project.toml
1 parent 7948ff1 commit 7336bc5

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "LazyArrays"
22
uuid = "5078a376-72f3-5289-bfd5-ec5146d43c02"
3-
version = "0.14.9"
3+
version = "0.14.10"
44

55

66
[deps]

src/lazyapplying.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ AbstractArray{T,N}(A::ApplyArray{<:Any,N}) where {T,N} = ApplyArray{T,N}(A.f, ma
184184

185185
@inline axes(A::ApplyArray) = axes(Applied(A))
186186
@inline size(A::ApplyArray) = map(length, axes(A))
187-
@inline copy(A::ApplyArray) = ApplyArray(A.f, map(copy,A.args)...)
187+
@inline copy(A::ApplyArray{T,N}) where {T,N} = ApplyArray{T,N}(A.f, map(copy,A.args)...)
188188

189189

190190
struct LazyArrayApplyStyle <: AbstractArrayApplyStyle end
@@ -305,4 +305,4 @@ getindex(A::ApplyMatrix{T,typeof(triu),<:Tuple{<:AbstractMatrix,<:Integer}}, k::
305305
replace_in_print_matrix(A::ApplyMatrix{<:Any,typeof(triu),<:Tuple{<:AbstractMatrix}}, i::Integer, j::Integer, s::AbstractString) =
306306
j  i ? replace_in_print_matrix(A.args[1], i, j, s) : replace_with_centered_mark(s)
307307
replace_in_print_matrix(A::ApplyMatrix{<:Any,typeof(triu),<:Tuple{<:AbstractMatrix,<:Integer}}, i::Integer, j::Integer, s::AbstractString) =
308-
j  i+A.args[2] ? replace_in_print_matrix(A.args[1], i, j, s) : replace_with_centered_mark(s)
308+
j  i+A.args[2] ? replace_in_print_matrix(A.args[1], i, j, s) : replace_with_centered_mark(s)

test/applytests.jl

+9
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,12 @@ end
4040
@test M isa ApplyArray
4141
@test M == exp(A)
4242
end
43+
44+
@testset "copy (#85)" begin
45+
Base.size(A::Applied) = (length(A.args[1]),)
46+
Base.eltype(A::Applied) = eltype(A.args[1])
47+
v = ApplyVector(vec, ones(Int, 2, 2))
48+
vc = copy(float.(v))
49+
ve = convert(Vector, vc)
50+
@test eltype(ve) == Float64
51+
end

0 commit comments

Comments
 (0)