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
2 changes: 1 addition & 1 deletion stdlib/REPL/src/docview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ struct Logged{F}
collection::Set{Pair{Module,Symbol}}
end
function (la::Logged)(m::Module, s::Symbol)
m !== la.mod && !Base.ispublic(m, s) && push!(la.collection, m => s)
m !== la.mod && Base.isdefined(m, s) && !Base.ispublic(m, s) && push!(la.collection, m => s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not quite sure what the intent is with this code, but checking whether a value is defined seems like a code smell when everything else here is checking for properties of the binding.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to log any instances of "this global access will succeed but is not public". If isdefined is false, then we'll get an error (or an explicit note that the access is not defined) and there is no need for a warning. I think that Base.isdefined(m, s) && !Base.ispublic(m, s) is equivalent to the (not defined) Base.isprivate(m, s).

la.f(m, s)
end
(la::Logged)(args...) = la.f(args...)
Expand Down
3 changes: 3 additions & 0 deletions stdlib/REPL/test/docview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,6 @@ module InternalWarningsTests
@test docstring("A.B3") == "No docstring or readme file found for public module `$(@__MODULE__).A.B3`.\n\nModule does not have any public names.\n"
end
end

# Issue #51344, don't print "internal binding" warning for non-existent bindings.
@test string(eval(REPL.helpmode("Base.no_such_symbol"))) == "No documentation found.\n\nBinding `Base.no_such_symbol` does not exist.\n"