Skip to content

Commit

Permalink
fix display of Set{<:Tuple} (fix #27680) (#27742)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet authored Jun 26, 2018
1 parent ffe61ca commit a23be08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,9 @@ function show_delim_array(io::IO, itr, op, delim, cl, delim_one, i1=1, n=typemax
while true
x = y[1]
y = iterate(itr, y[2])
show(IOContext(recur_io, :typeinfo =>
typeinfo <: Tuple ? fieldtype(typeinfo, i1+i0) : typeinfo),
show(IOContext(recur_io, :typeinfo => itr isa typeinfo <: Tuple ?
fieldtype(typeinfo, i1+i0) :
typeinfo),
x)
i1 += 1
if y === nothing || i1 > n
Expand Down
5 changes: 5 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,11 @@ end
A = [0.0, 1.0]
@test replstr(view(A, [1], :)) == "1×1 view(::Array{Float64,2}, [1], :) with eltype Float64:\n 0.0"

# issue #27680
@test replstr(Set([(1.0,1.0), (2.0,2.0), (3.0, 3.0)])) == (sizeof(Int) == 8 ?
"Set(Tuple{Float64,Float64}[(3.0, 3.0), (2.0, 2.0), (1.0, 1.0)])" :
"Set(Tuple{Float64,Float64}[(1.0, 1.0), (2.0, 2.0), (3.0, 3.0)])")

# issue #25857
@test repr([(1,),(1,2),(1,2,3)]) == "Tuple{$Int,Vararg{$Int,N} where N}[(1,), (1, 2), (1, 2, 3)]"

Expand Down

0 comments on commit a23be08

Please sign in to comment.