Skip to content

Commit

Permalink
specify method for vcat to avoid ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
vpuri3 committed Oct 30, 2023
1 parent d22a56c commit e71eaae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/array_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ second_axis(::ComponentVector) = FlatAxis()

# Are all these methods necessary?
# TODO: See what we can reduce down to without getting ambiguity errors
Base.vcat(x::ComponentVector, y::AbstractVector) = vcat(getdata(x), y)
Base.vcat(x::AbstractVector, y::ComponentVector) = vcat(x, getdata(y))
Base.vcat(x::ComponentVector{<:Number}, y::AbstractVector{<:Number}) = vcat(getdata(x), y)
Base.vcat(x::AbstractVector{<:Number}, y::ComponentVector{<:Number}) = vcat(x, getdata(y))
function Base.vcat(x::ComponentVector, y::ComponentVector)
if reduce((accum, key) -> accum || (key in keys(x)), keys(y); init=false)
return vcat(getdata(x), getdata(y))
Expand Down Expand Up @@ -147,4 +147,4 @@ end
Base.stride(x::ComponentArray, k) = stride(getdata(x), k)
Base.stride(x::ComponentArray, k::Int64) = stride(getdata(x), k)

ArrayInterface.parent_type(::Type{ComponentArray{T,N,A,Axes}}) where {T,N,A,Axes} = A
ArrayInterface.parent_type(::Type{ComponentArray{T,N,A,Axes}}) where {T,N,A,Axes} = A

0 comments on commit e71eaae

Please sign in to comment.