-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself
Description
Previous ID | SR-3111 |
Radar | None |
Original Reporter | @karwa |
Type | Bug |
Environment
Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38)
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 9cf9a32b39718d5dd45d91c24a104529
Issue Description:
As I understand it, private at top-level is synonymous with fileprivate; so the following code should be fine. In practice the compiler won't have it.
struct MyStruct {
init() { doSomething() }
}
private extension MyStruct {
fileprivate func doSomething() { print("doing something...") }
}
test.swift:22:5: warning: declaring a fileprivate instance method in a private extension
fileprivate func doSomething() { print("doing something...") }
^~~~~~~~~~~
private
test.swift:18:14: error: 'doSomething' is inaccessible due to 'private' protection level
init() { doSomething() }
^
test.swift:22:22: note: 'doSomething()' declared here
fileprivate func doSomething() { print("doing something...") }
^
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself