Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1407,11 +1407,11 @@ function show_delim_array(io::IO, itr::Union{AbstractArray,SimpleVector}, op, de
x = itr[i]
show(recur_io, x)
end
i += 1
if i > l
if i == l
delim_one && first && print(io, delim)
break
end
i += 1
first = false
print(io, delim)
print(io, ' ')
Expand Down
9 changes: 9 additions & 0 deletions test/offsetarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,15 @@ end
@test CartesianIndices(A) == CartesianIndices(B)
end

@testset "overflowing show" begin
A = OffsetArray(repeat([1], 1), typemax(Int)-1)
b = IOBuffer(maxsize=10)
show(b, A)
@test String(take!(b)) == "[1]"
show(b, (A, A))
@test String(take!(b)) == "([1], [1])"
end

@testset "indexing views (#53249)" begin
v = view([1,2,3,4], :)
@test v[Base.IdentityUnitRange(2:3)] == OffsetArray(2:3, 2:3)
Expand Down