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

[SR-8306] declaring a fileprivate instance method in a private extension #50834

Closed
AnthonyLatsis opened this issue Jul 18, 2018 · 3 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself good first issue Good for newcomers

Comments

@AnthonyLatsis
Copy link
Collaborator

Previous ID SR-8306
Radar None
Original Reporter @AnthonyLatsis
Type Bug
Status Closed
Resolution Done
Environment

Version 9.4.1 (9F2000)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, StarterBug
Assignee dingobye (JIRA)
Priority Medium

md5: 2c94bb213e8bd96282b0f290be64d309

Issue Description:

private extension Foo {
    fileprivate func foo() {} // warning: declaring a fileprivate instance method in a private extension
}

The source of the problem probably lies in the fact that extensions are top level declarations, for which private and fileprivate are equivalent.
foo() obviously can't be more than fileprivate and will be so by default, so we can safely omit its access level here. The warning, however, seems to be unnecessary (we have full right to have foo explicitly fileprivate) and ill-advised (it offers a fix-it that downgrades foo to private)

@belkadan
Copy link
Contributor

Good catch.

@swift-ci
Copy link
Collaborator

Comment by Ding Ye (JIRA)

Good point! I would like to work it out if no one else takes this.

@swift-ci
Copy link
Collaborator

Comment by Ding Ye (JIRA)

#18105

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants