mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
A @_fixed_layout protocol exposes its witness table layout to clients, which prevents re-ordering of requirements or adding new requiremenst with a default. When library evolution is enabled, we still emit method descriptors even for @_fixed_layout protocols; this allows a previously-resilient protocol to become @_fixed_layout as long as the published layout matches the resilient layout in all previously-shipped versions of the library.
46 lines
979 B
Swift
46 lines
979 B
Swift
|
|
public protocol OtherResilientProtocol {
|
|
}
|
|
|
|
var x: Int = 0
|
|
|
|
extension OtherResilientProtocol {
|
|
public var propertyInExtension: Int {
|
|
get { return x }
|
|
set { x = newValue }
|
|
}
|
|
|
|
public static var staticPropertyInExtension: Int {
|
|
get { return x }
|
|
set { x = newValue }
|
|
}
|
|
}
|
|
|
|
public protocol ResilientBaseProtocol {
|
|
func requirement() -> Int
|
|
}
|
|
|
|
public protocol ResilientDerivedProtocol : ResilientBaseProtocol {}
|
|
|
|
public protocol ProtocolWithRequirements {
|
|
associatedtype T
|
|
func first()
|
|
func second()
|
|
}
|
|
|
|
public struct Wrapper<T>: OtherResilientProtocol { }
|
|
|
|
public struct ConcreteWrapper: OtherResilientProtocol { }
|
|
|
|
public protocol ProtocolWithAssocTypeDefaults {
|
|
associatedtype T1 = Self
|
|
associatedtype T2: OtherResilientProtocol = Wrapper<T1>
|
|
}
|
|
|
|
public protocol ResilientSelfDefault : ResilientBaseProtocol {
|
|
associatedtype AssocType: ResilientBaseProtocol = Self
|
|
}
|
|
|
|
@_fixed_layout public protocol OtherFrozenProtocol {
|
|
func protocolMethod()
|
|
} |