Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only warn in helpmode on successful nonpublic access #51346

Merged
merged 1 commit into from Oct 24, 2023

Conversation

LilithHafner
Copy link
Member

Fixes #51344
Bug introduced by #50105

@LilithHafner LilithHafner added domain:docs This change adds or pertains to documentation kind:bugfix This change fixes an existing bug labels Sep 16, 2023
@@ -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
Sponsor 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).

@LilithHafner LilithHafner added needs tests Unit tests are required for this change and removed needs tests Unit tests are required for this change labels Oct 24, 2023
@LilithHafner
Copy link
Member Author

Already had tests, lol

@LilithHafner LilithHafner merged commit a6d9df7 into master Oct 24, 2023
9 of 10 checks passed
@LilithHafner LilithHafner deleted the lh/warn-nonpublic-fixup branch October 24, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation kind:bugfix This change fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Help says "The following bindings may be internal" for non-existent names
2 participants