mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The setter needs to be given hidden linkage so that other files can still form key paths to it.
20 lines
298 B
Swift
20 lines
298 B
Swift
struct A {
|
|
private(set) var x: Int {
|
|
get { return 0 }
|
|
set {}
|
|
}
|
|
|
|
private(set) subscript(x: Int) -> Int {
|
|
get { return 0 }
|
|
set {}
|
|
}
|
|
}
|
|
|
|
func A_x_keypath() -> WritableKeyPath<A, Int> {
|
|
return \A.x
|
|
}
|
|
|
|
func A_subscript_0_keypath() -> WritableKeyPath<A, Int> {
|
|
return \A.[0]
|
|
}
|