Skip to content

Commit

Permalink
fix #30303, escaping $ when showing Symbols (#30304)
Browse files Browse the repository at this point in the history
* fix #30303, escaping $ when showing Symbols

* use repr instead of escape_string

(cherry picked from commit f0b9499)
  • Loading branch information
JeffBezanson authored and KristofferC committed Dec 30, 2018
1 parent 160054e commit d9a3592
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ function show_unquoted_quote_expr(io::IO, @nospecialize(value), indent::Int, pre
print(io, ":")
print(io, value)
else
print(io, "Symbol(\"", escape_string(s), "\")")
print(io, "Symbol(", repr(s), ")")
end
else
if isa(value,Expr) && value.head === :block
Expand Down
3 changes: 3 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1402,3 +1402,6 @@ end
replstrcolor(x) = sprint((io, x) -> show(IOContext(io, :limit => true, :color => true),
MIME("text/plain"), x), x)
@test occursin("\e[", replstrcolor(`curl abc`))

# issue #30303
@test repr(Symbol("a\$")) == "Symbol(\"a\\\$\")"

0 comments on commit d9a3592

Please sign in to comment.