-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix redundant access-level modifiers. #1663
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
Conversation
@swift-ci please test |
Thank you for triggering the test, Simon! It would be greatly appreciated if you could also help review. |
How can we verify that we haven't accidentally changed the public visibility of some of these setters? |
@parkera Hi Tony, sorry I might not quite get what you meant. Can you point out some particular setters for example? Because I cannot see any existing property setter with Let us examine the relevant code. All extensions having their
In summary, all computed properties are get-only, and all static stored properties are constant. As a result, there isn't any property with a setter... When I was trying to remove the |
I guess I was looking for some kind of comparison of Swift's generated headers, as a check to make sure we aren't accidentally dropping public from something that had it before - or the opposite. Code inspection is good, but double checking is better. |
Hi Tony, do you mean
and
This is because their underlying serialised ASTs are different, though they result in the same access level effect for If we would have to perform some kind of automatic checking, an easy way I can come up with is to write some XCTest in When trying the approach above, I was stoped by something else. To begin with, I used Are you able to reproduce these errors? |
I don't think we need a unit test to verify all access, I just want to gain some additional confidence in this change. I'm not sure why the redundant access modifiers are a problem in the first place; it's often very useful as a library author to have a reminder of the public/private nature of what you're looking at. With them removed it lowers the confidence of a change being neutral to clients. |
I guess if we trust that the compiler is right about the warning, then perhaps just a list of the warnings from the change in your associated PR plus a list of the warnings from this change would be enough for now. |
Thanks for your suggestions, Tony! Actually, the modifications in this PR were inspired by the observation of warning lists. Here I collect the warning data for the following four scenarios:
Below is the comprehensive list of such 103 warnings:
|
Great, thanks for double checking. This looks good to me. Can this be merged prior to your other change? |
Thank you, Tony! Yes, this one should be merged before landing the associated PR. |
This patch aims at making corelibs-foundation adapted to this PR, which warns for redundant access-level modifiers.
@phausler Hi Philippe, would you help take a look at this, please?