mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
If the conforming type is generic, we have to treat the conformance as resilient if it is defined outside of the current module. This is because it can resiliently change from being non-dependent to dependent.
43 lines
900 B
Swift
43 lines
900 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
|
|
}
|