Skip to content

Commit 40bceb2

Browse files
authored
Show modules with invalid name using var"" (#43932)
1 parent de21be7 commit 40bceb2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

base/show.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,11 +1110,11 @@ end
11101110
function print_fullname(io::IO, m::Module)
11111111
mp = parentmodule(m)
11121112
if m === Main || m === Base || m === Core || mp === m
1113-
print(io, nameof(m))
1113+
show_sym(io, nameof(m))
11141114
else
11151115
print_fullname(io, mp)
11161116
print(io, '.')
1117-
print(io, nameof(m))
1117+
show_sym(io, nameof(m))
11181118
end
11191119
end
11201120

test/show.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,10 @@ end
524524
module M1 var"#foo#"() = 2 end
525525
@test occursin("M1.var\"#foo#\"", sprint(show, M1.var"#foo#", context = :module=>@__MODULE__))
526526

527+
# PR #43932
528+
module var"#43932#" end
529+
@test endswith(sprint(show, var"#43932#"), ".var\"#43932#\"")
530+
527531
# issue #12477
528532
@test sprint(show, Union{Int64, Int32, Int16, Int8, Float64}) == "Union{Float64, Int16, Int32, Int64, Int8}"
529533

0 commit comments

Comments
 (0)