Skip to content

Commit 7e95379

Browse files
committed
Fixed convert method
1 parent 8d7352c commit 7e95379

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ComponentArrays"
22
uuid = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
33
authors = ["Jonnie Diegelman <47193959+jonniedie@users.noreply.github.com>"]
4-
version = "0.11.9"
4+
version = "0.11.10"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/similar_convert_copy.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ end
5353
function Base.convert(::Type{ComponentArray{T1,N,A1,Ax1}}, x::ComponentArray{T2,N,A2,Ax2}) where {T1,T2,N,A1,A2,Ax1,Ax2}
5454
return T1.(x)
5555
end
56-
Base.convert(::Type{<:Array}, x::ComponentArray) = convert(Array, getdata(x))
56+
Base.convert(T::Type{<:Array}, x::ComponentArray) = convert(T, getdata(x))
5757

5858
Base.convert(::Type{Cholesky{T1,Matrix{T1}}}, x::Cholesky{T2,<:ComponentArray}) where {T1,T2} = Cholesky(Matrix{T1}(x.factors), x.uplo, x.info)
5959

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ end
338338
@test convert(typeof(cmat), cmat) == cmat
339339

340340
@test convert(Array, ca) == getdata(ca)
341+
@test convert(Matrix{Float32}, cmat) isa Matrix{Float32}
341342
end
342343

343344
@testset "Broadcasting" begin

0 commit comments

Comments
 (0)