diff --git a/src/Containers/DenseAxisArray.jl b/src/Containers/DenseAxisArray.jl index 48cd7d3c9d2..c5866f44f10 100644 --- a/src/Containers/DenseAxisArray.jl +++ b/src/Containers/DenseAxisArray.jl @@ -402,13 +402,17 @@ function _kwargs_to_args(A::DenseAxisArray{T,N}; kwargs...) where {T,N} end end -function Base.getindex(A::DenseAxisArray{T,N}, args...; kwargs...) where {T,N} +function Base.getindex(A::DenseAxisArray, args...; kwargs...) if !isempty(kwargs) if !isempty(args) error("Cannot index with mix of positional and keyword arguments") end - return getindex(A, _kwargs_to_args(A; kwargs...)...) + return _getindex_inner(A, _kwargs_to_args(A; kwargs...)...) end + return _getindex_inner(A, args...) +end + +function _getindex_inner(A::DenseAxisArray{T}, args::Vararg{Any,N}) where {T,N} new_indices = Base.to_index(A, args) if !any(_is_range, new_indices) return A.data[new_indices...]::T