mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Since field offsets are now encoded after generic parameters, it is useful to validate that using generic parameter metadata is now more resilient in presence of new fields.
40 lines
429 B
Swift
40 lines
429 B
Swift
|
|
public func getVersion() -> Int {
|
|
#if BEFORE
|
|
return 0
|
|
#else
|
|
return 1
|
|
#endif
|
|
}
|
|
|
|
public protocol P {
|
|
static func compute() -> Int
|
|
}
|
|
|
|
public struct A : P {
|
|
public init() {}
|
|
|
|
public static func compute() -> Int {
|
|
return 42
|
|
}
|
|
}
|
|
|
|
#if BEFORE
|
|
|
|
public struct S<T: P> {
|
|
public init() {}
|
|
}
|
|
|
|
#else
|
|
|
|
public struct S<T: P> {
|
|
public init() {
|
|
question = "Ultimate Question"
|
|
}
|
|
|
|
public var question: String
|
|
}
|
|
|
|
#endif
|
|
|