Skip to content

Commit

Permalink
Fix dump in the presence of nothing (#27991)
Browse files Browse the repository at this point in the history
Currently anything that's `dump`ed that contains `nothing` will error,
since there's no logic in place for handling `nothing` in `dump` after
PR #27829.
  • Loading branch information
ararslan authored Jul 9, 2018
1 parent 6638469 commit 8d48f7b
Show file tree
Hide file tree
Showing 2 changed files with 6 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 @@ -1611,8 +1611,9 @@ function dump(io::IOContext, @nospecialize(x), n::Int, indent)
end
end
end
else
!isa(x, Function) && print(io, " ", x)
elseif !isa(x, Function)
print(io, " ")
show(io, x)
end
nothing
end
Expand Down
3 changes: 3 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,9 @@ end
let repr = sprint(dump, Test)
@test repr == "Module Test\n"
end
let repr = sprint(dump, nothing)
@test repr == "Nothing nothing\n"
end
let a = Vector{Any}(undef, 10000)
a[2] = "elemA"
a[4] = "elemB"
Expand Down

0 comments on commit 8d48f7b

Please sign in to comment.