mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
One minor revision: this lifts the proposed restriction against overriding a non-open method with an open one. On reflection, that was inconsistent with the existing rule permitting non-public methods to be overridden with public ones. The restriction on subclassing a non-open class with an open class remains, and is in fact consistent with the existing access rule.
44 lines
984 B
Swift
44 lines
984 B
Swift
public struct MarkerForNonOpenSubscripts { public init() {} }
|
|
public struct MarkerForOpenSubscripts { public init() {} }
|
|
|
|
public class ExternalNonOpenClass {
|
|
init() {}
|
|
public func nonOpenMethod() {}
|
|
public var nonOpenProperty: Int = 0
|
|
public subscript(index: MarkerForNonOpenSubscripts) -> Int {
|
|
get { return 0 }
|
|
set {}
|
|
}
|
|
}
|
|
|
|
open class ExternalOpenClass {
|
|
init() {}
|
|
open func openMethod() {}
|
|
open var openProperty: Int = 0
|
|
open subscript(index: MarkerForOpenSubscripts) -> Int {
|
|
get { return 0 }
|
|
set {}
|
|
}
|
|
|
|
public func nonOpenMethod() {}
|
|
public var nonOpenProperty: Int = 0
|
|
public subscript(index: MarkerForNonOpenSubscripts) -> Int {
|
|
get { return 0 }
|
|
set {}
|
|
}
|
|
|
|
public class PublicClass { public init() {} }
|
|
open class OpenClass { public init() {} }
|
|
}
|
|
|
|
public struct ExternalStruct {
|
|
open class OpenClass {
|
|
public init() {}
|
|
}
|
|
}
|
|
|
|
internal struct ExternalInternalStruct {
|
|
open class OpenClass {
|
|
public init() {}
|
|
}
|
|
} |