Skip to content

Commit db4016c

Browse files
aviateskstaticfloat
authored andcommitted
fix erroneous code path within show_sym (#38830)
fix erroneous code path within `show_sym` currently, `show_sym` can recur into `show(::IO, String)`, but it's a bit "erroneous" since `is_syntactic_operator(::String)` is not defined. (cherry picked from commit 6322b8c)
1 parent 58a7976 commit db4016c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

base/show.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,12 +1434,12 @@ end
14341434
# Print `sym` as it would appear as an identifier name in code
14351435
# * Print valid identifiers & operators literally; also macros names if allow_macroname=true
14361436
# * Escape invalid identifiers with var"" syntax
1437-
function show_sym(io::IO, sym; allow_macroname=false)
1437+
function show_sym(io::IO, sym::Symbol; allow_macroname=false)
14381438
if is_valid_identifier(sym)
14391439
print(io, sym)
14401440
elseif allow_macroname && (sym_str = string(sym); startswith(sym_str, '@'))
14411441
print(io, '@')
1442-
show_sym(io, sym_str[2:end])
1442+
show_sym(io, Symbol(sym_str[2:end]))
14431443
else
14441444
print(io, "var", repr(string(sym)))
14451445
end

0 commit comments

Comments
 (0)