Skip to content

Commit

Permalink
show unqualified name in print of Function (JuliaLang#30565)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Feb 5, 2019
1 parent f52c911 commit 9285059
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ function show(io::IO, f::Function)
end
end

print(io::IO, f::Function) = print(io, nameof(f))

function show(io::IO, x::Core.IntrinsicFunction)
name = ccall(:jl_intrinsic_name, Cstring, (Core.IntrinsicFunction,), x)
print(io, unsafe_string(name))
Expand Down
4 changes: 4 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,10 @@ replstrcolor(x) = sprint((io, x) -> show(IOContext(io, :limit => true, :color =>
# issue #30303
@test repr(Symbol("a\$")) == "Symbol(\"a\\\$\")"

@test string(sin) == "sin"
@test string(Iterators.flatten) == "flatten"
@test Symbol(Iterators.flatten) === :flatten

# printing of bools and bool arrays
@testset "Bool" begin
@test repr(true) == "true"
Expand Down

0 comments on commit 9285059

Please sign in to comment.