Skip to content

Commit 84202c5

Browse files
committed
Fix one more map(length, inds)
1 parent 59ee7cf commit 84202c5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/OffsetArrays.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ OffsetArray(A::AbstractArray{T,N}, offsets::Vararg{Int,N}) where {T,N} =
1818
OffsetArray(A, offsets)
1919

2020
OffsetArray{T,N}(::UndefInitializer, inds::Indices{N}) where {T,N} =
21-
OffsetArray{T,N,Array{T,N}}(Array{T,N}(undef, map(length, inds)), map(indexoffset, inds))
21+
OffsetArray{T,N,Array{T,N}}(Array{T,N}(undef, map(indexlength, inds)), map(indexoffset, inds))
2222
OffsetArray{T}(::UndefInitializer, inds::Indices{N}) where {T,N} = OffsetArray{T,N}(undef, inds)
2323
OffsetArray{T,N}(::UndefInitializer, inds::Vararg{AbstractUnitRange,N}) where {T,N} = OffsetArray{T,N}(undef, inds)
2424
OffsetArray{T}(::UndefInitializer, inds::Vararg{AbstractUnitRange,N}) where {T,N} = OffsetArray{T,N}(undef, inds)

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ y = OffsetArray(r, r)
3434
y = OffsetArray(r, (r,))
3535
@test axes(y) == (r,)
3636

37+
y = OffsetArray{Float32}(undef, (Base.Slice(-1:1),))
38+
@test axes(y) === (Base.Slice(-1:1),)
39+
3740
A0 = [1 3; 2 4]
3841
A = OffsetArray(A0, (-1,2)) # IndexLinear
3942
S = OffsetArray(view(A0, 1:2, 1:2), (-1,2)) # IndexCartesian

0 commit comments

Comments
 (0)