mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Similar to apple/swift#3753. Groundwork for SE-0025 ('private' and 'fileprivate'). No intended functionality change.
29 lines
571 B
Swift
29 lines
571 B
Swift
// Things in this file are deliberately internal. The test harness uses @testable import.
|
|
|
|
internal class Base : CustomStringConvertible {
|
|
let id: Int
|
|
|
|
init(_ id: Int) {
|
|
self.id = id
|
|
}
|
|
|
|
var description: String { return "instance \(id)" }
|
|
|
|
fileprivate func privateFn() -> String {
|
|
return "private \(id)"
|
|
}
|
|
func callPrivate() -> String {
|
|
return privateFn()
|
|
}
|
|
}
|
|
|
|
private class PrivateSub : Base {
|
|
override func privateFn() -> String {
|
|
return "really private"
|
|
}
|
|
}
|
|
|
|
internal func getPrivateInstance() -> Base {
|
|
return PrivateSub(0)
|
|
}
|