Skip to content

Commit

Permalink
fix a :typeinfo property in show_default (SQUASH ME)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Dec 7, 2017
1 parent 2cb6a3d commit 6c92664
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/arrayshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ end
# X not constrained, can be any iterable (cf. show_vector)
function typeinfo_prefix(io::IO, X)
typeinfo = get(io, :typeinfo, Any)::Type
@assert X isa typeinfo
@assert X isa typeinfo "$(typeof(X)) is not a subtype of $typeinfo"
# what the context already knows about the eltype of X:
eltype_ctx = typeinfo_eltype(typeinfo)
eltype_X = eltype(X)
Expand Down
3 changes: 2 additions & 1 deletion base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ function show_default(io::IO, @nospecialize(x))
nb = sizeof(x)
if nf != 0 || nb == 0
if !show_circular(io, x)
recur_io = IOContext(io, Pair{Symbol,Any}(:SHOWN_SET, x))
recur_io = IOContext(io, Pair{Symbol,Any}(:SHOWN_SET, x),
Pair{Symbol,Any}(:typeinfo, Any))
for i in 1:nf
f = fieldname(t, i)
if !isdefined(x, f)
Expand Down
1 change: 1 addition & 0 deletions test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ fake_repl() do stdin_write, stdout_read, repl
redirect_stdout(old_stdout)
end
close(proc_stdout)
@test contains(wait(get_stdout), "HI\n")
@test wait(get_stdout) == "HI\n"
end

Expand Down

0 comments on commit 6c92664

Please sign in to comment.