mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Since this is a source breaking change, downgrade the diagnostic to a warning until the next language version unless library evolution is enabled, in which case this would have resulted in a broken `.swiftinterface` and it therefore makes sense to diagnose eagerly. Resolves rdar://156919010.
35 lines
640 B
Swift
35 lines
640 B
Swift
// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
// Check if the optimizer does not crash.
|
|
|
|
import Foundation
|
|
|
|
@dynamicMemberLookup
|
|
public struct S {
|
|
private let x: NSXPCConnection
|
|
|
|
public subscript<T>(dynamicMember property: ReferenceWritableKeyPath<NSXPCConnection, T>) -> T {
|
|
get {
|
|
x[keyPath: property]
|
|
}
|
|
nonmutating set {
|
|
x[keyPath: property] = newValue
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// CHECK: sil {{.*}}test_set
|
|
public func test_set(s: S) {
|
|
s.invalidationHandler = {}
|
|
}
|
|
|
|
// CHECK: sil {{.*}}test_get
|
|
public func test_get(s: S) -> (() -> ())? {
|
|
return s.invalidationHandler
|
|
}
|
|
|
|
|