Skip to content

Commit e9ef280

Browse files
authored
Fix showindices for IdentityUnitRange (#40608)
1 parent b5177e7 commit e9ef280

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

base/show.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2848,7 +2848,7 @@ function showarg(io::IO, v::SubArray, toplevel)
28482848
toplevel && print(io, " with eltype ", eltype(v))
28492849
return nothing
28502850
end
2851-
showindices(io, ::Union{Slice,IdentityUnitRange}, inds...) =
2851+
showindices(io, ::Slice, inds...) =
28522852
(print(io, ", :"); showindices(io, inds...))
28532853
showindices(io, ind1, inds...) =
28542854
(print(io, ", ", ind1); showindices(io, inds...))

test/show.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,11 @@ end
16671667
@test summary(p) == "2-element reinterpret(reshape, Tuple{Float32, Float32}, ::Matrix{Float32}) with eltype Tuple{Float32, Float32}"
16681668
@test Base.showarg(io, p, false) === nothing
16691669
@test String(take!(io)) == "reinterpret(reshape, Tuple{Float32, Float32}, ::Matrix{Float32})"
1670+
1671+
r = Base.IdentityUnitRange(2:2)
1672+
B = @view ones(2)[r]
1673+
Base.showarg(io, B, false)
1674+
@test String(take!(io)) == "view(::Vector{Float64}, $(repr(r)))"
16701675
end
16711676

16721677
@testset "Methods" begin

0 commit comments

Comments
 (0)