Skip to content

Commit

Permalink
Fix printing of Expr(:vcat)
Browse files Browse the repository at this point in the history
Closes #15525

(cherry picked from commit e8d2b02)
ref #15527
  • Loading branch information
yuyichao authored and tkelman committed Jun 17, 2016
1 parent c47090d commit a935100
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ function show_unquoted(io::IO, ex::Expr, indent::Int, prec::Int)
# list (i.e. "(1,2,3)" or "[1,2,3]")
elseif haskey(expr_parens, head) # :tuple/:vcat/:cell1d
op, cl = expr_parens[head]
if head === :vcat && !isempty(args) && is_expr(args[1], :row)
if head === :vcat
sep = ";"
elseif head === :hcat || head === :row
sep = " "
Expand All @@ -531,7 +531,9 @@ function show_unquoted(io::IO, ex::Expr, indent::Int, prec::Int)
end
head !== :row && print(io, op)
show_list(io, args, sep, indent)
if is(head, :tuple) && nargs == 1; print(io, ','); end
if (head === :tuple || head === :vcat) && nargs == 1
print(io, sep)
end
head !== :row && print(io, cl)

# function call
Expand Down
6 changes: 6 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,9 @@ macro strquote(ex)
end
str_ex2a, str_ex2b = @strquote(begin x end), string(quote x end)
@test str_ex2a == str_ex2b

# Issue #15525, printing of vcat
@test sprint(show, :([a;])) == ":([a;])"
@test sprint(show, :([a;b])) == ":([a;b])"
@test_repr "[a;]"
@test_repr "[a;b]"

0 comments on commit a935100

Please sign in to comment.