diff --git a/base/show.jl b/base/show.jl index 398d1ea4e3a3e..011451601e05e 100644 --- a/base/show.jl +++ b/base/show.jl @@ -1601,7 +1601,10 @@ function show_unquoted(io::IO, ex::Expr, indent::Int, prec::Int, quote_level::In # scalar multiplication (i.e. "100x") elseif (func === :* && length(func_args) == 2 && isa(func_args[1], Union{Int, Int64, Float32, Float64}) && - isa(func_args[2], Symbol) && !in(string(func_args[2]::Symbol)[1], ('e', 'E', 'f'))) + isa(func_args[2], Symbol) && + !in(string(func_args[2]::Symbol)[1], ('e', 'E', 'f', (func_args[1] == 0 && func_args[1] isa Integer ? + # don't juxtapose 0 with b, o, x + ('b', 'o', 'x') : ())...))) if func_prec <= prec show_enclosed_list(io, '(', func_args, "", ')', indent, func_prec, quote_level) else diff --git a/test/show.jl b/test/show.jl index 0f5706906e69c..d48c180306f9c 100644 --- a/test/show.jl +++ b/test/show.jl @@ -235,7 +235,10 @@ for ex in [Expr(:call, :f, Expr(:(=), :x, 1)), Expr(:call, :+, :n, Expr(:kw, :x, 1)), :((a=1,; $(Expr(:(=), :x, 2)))), :(($(Expr(:(=), :a, 1)),; x = 2)), - Expr(:tuple, Expr(:parameters))] + Expr(:tuple, Expr(:parameters)), + Expr(:call, :*, 0, :x01), + Expr(:call, :*, 0, :b01), + Expr(:call, :*, 0, :o01)] @test eval(Meta.parse(repr(ex))) == ex end