-
Notifications
You must be signed in to change notification settings - Fork 159
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
Top level private
is understood as fileprivate
#112
Comments
This is expected as far as I am concerned: at the top level, cc @amartini51 Whether we still have room for the now source-breaking (albeit reasonable) behavioural exception you expected is worth discussing on the Swift forums, unless it already was. |
@amartini51 ping |
I'm not entirely clear what the documentation issue is here. It seems like it might be related to top-level |
Yes, top-level The book also states that the members of a |
private
is understood as fileprivate
Description
A class extension that is declared as private automatically turns all methods and types declared in the extension as private. This gets rid of the need to explicitly declare each method and type declared in the extension as private. However, if a type (say, an enum) declared in the extension is explicitly declared as private (which would be unnecessary but seems to be legal), and if one of the methods in the extension takes this enum as a parameter, then the compiler requires that the method be explicitly declared as private as well.
Steps to reproduce
The compiler stops complaining if the enum
Bar
isn't explicitly declared as private anymore. However, whether the enumBar
is explicitly declared as private or not, it will be private by virtue of being inside a private extension.Is this a bug? To me it seems so, but if others have different opinions I'd like to hear them as well.
Environment
swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
Target: x86_64-apple-macosx12.0
Xcode 14.2
Build version 14C18
macOS 12.0
The text was updated successfully, but these errors were encountered: