Skip to content

Commit

Permalink
Fix multi-symbol indexing when components are matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
jonniedie committed May 11, 2024
1 parent e7f766e commit 9f392b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/axis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function Base.getindex(ax::AbstractAxis, syms::Union{NTuple{N,Symbol}, <:Abstrac
return ComponentIndex(vcat(inds...), new_ax)
end

_maybe_view_axis(inds, ax::Axis) = ViewAxis(inds, ax)
_maybe_view_axis(inds, ax::AbstractAxis) = ViewAxis(inds, ax)
_maybe_view_axis(inds, ::NullAxis) = inds[1]

struct CombinedAxis{C,A} <: AbstractUnitRange{Int}
Expand Down
5 changes: 4 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ end
# We had to revert this because there is no way to work around
# OffsetArrays' type piracy without introducing type piracy
# ourselves because `() isa Tuple{N, <:CombinedAxis} where {N}`
# @test reshape(a, axes(ca)...) isa Vector{Float64}
@test_broken reshape(a, axes(ca)...) isa Vector{Float64}

# Issue #265: Multi-symbol indexing with matrix components
@test ca2.c[[:a, :b]].b isa AbstractMatrix
end

@testset "Set" begin
Expand Down

0 comments on commit 9f392b3

Please sign in to comment.