Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion base/docs/bindings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ function Base.show(io::IO, b::Binding)
if b.mod === Base.active_module()
print(io, b.var)
else
print(io, b.mod, '.', Base.isoperator(b.var) ? ":" : "", b.var)
print(io, b.mod, '.')
if Base.isoperator(b.var)
# ensures symbols are quoted right, so e.g. :(==), :(:), :+ or :-
show(io, b.var)
else
# print ordinary identifiers without any quoting
print(io, b.var)
end
end
end

Expand Down
4 changes: 4 additions & 0 deletions test/docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,10 @@ let x = Binding(Main, :+)
@test Meta.parse(string(x)) == :(Base.:+)
end

let x = Binding(Main, :(:))
@test Meta.parse(string(x)) == :(Base.:(:))
end

let x = Binding(Meta, :parse)
@test Meta.parse(string(x)) == :(Base.Meta.parse)
end
Expand Down