Skip to content

Commit 9bd09f4

Browse files
authored
[Containers] fix DenseAxisArray with Base.OneTo{<:Integer} (#4054)
1 parent 279b93d commit 9bd09f4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Containers/DenseAxisArray.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ function Base.to_index(A::DenseAxisArray{T,N}, idx) where {T,N}
385385
end
386386

387387
_is_range(::Any) = false
388-
_is_range(::Union{Vector{Int},Colon}) = true
388+
_is_range(::Colon) = true
389+
_is_range(::AbstractVector{<:Integer}) = true
389390

390391
function _kwargs_to_args(A::DenseAxisArray{T,N}; kwargs...) where {T,N}
391392
return ntuple(N) do i

test/Containers/test_DenseAxisArray.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,4 +933,10 @@ function test_promote_shape()
933933
return
934934
end
935935

936+
function test_container_Base_OneTo_Integer()
937+
Containers.@container(x[i = 0x01:0x08], 2 * i)
938+
@test x[0x01:0x02] == Containers.@container([i = 0x01:0x02], 2 * i)
939+
return
940+
end
941+
936942
end # module

0 commit comments

Comments
 (0)