Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into patch-32
Browse files Browse the repository at this point in the history
PallHaraldsson authored Nov 24, 2024
2 parents 2f976f3 + 377643f commit 5236b8e
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/show.jl
Original file line number Diff line number Diff line change
@@ -443,7 +443,7 @@ function show_circular(io::IOContext, @nospecialize(x))
for (k, v) in io.dict
if k === :SHOWN_SET
if v === x
print(io, "#= circular reference @-$d =#")
printstyled(io, "#= circular reference @-$d =#"; color = :yellow)
return true
end
d += 1
1 change: 1 addition & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
@@ -1275,6 +1275,7 @@ let x = [], y = [], z = Base.ImmutableDict(x => y)
push!(y, x)
push!(y, z)
@test replstr(x) == "1-element Vector{Any}:\n Any[Any[#= circular reference @-2 =#], Base.ImmutableDict{Vector{Any}, Vector{Any}}([#= circular reference @-3 =#] => [#= circular reference @-2 =#])]"
@test replstr(x, :color => true) == "1-element Vector{Any}:\n Any[Any[\e[33m#= circular reference @-2 =#\e[39m], Base.ImmutableDict{Vector{Any}, Vector{Any}}([\e[33m#= circular reference @-3 =#\e[39m] => [\e[33m#= circular reference @-2 =#\e[39m])]"
@test repr(z) == "Base.ImmutableDict{Vector{Any}, Vector{Any}}([Any[Any[#= circular reference @-2 =#], Base.ImmutableDict{Vector{Any}, Vector{Any}}(#= circular reference @-3 =#)]] => [Any[Any[#= circular reference @-2 =#]], Base.ImmutableDict{Vector{Any}, Vector{Any}}(#= circular reference @-2 =#)])"
@test sprint(dump, x) == """
Array{Any}((1,))

0 comments on commit 5236b8e

Please sign in to comment.