mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Implement the final approved syntax for SE-227 identity key paths.
`\.self` is the final chosen syntax. Implement support for this syntax, and remove the stopgap builtin and `WritableKeyPath._identity` property that were in place before.
This commit is contained in:
@@ -389,10 +389,10 @@ func subclass_generics<T: C<Int>, U: C<V>, V/*: PoC*/>(_: T, _: U, _: V) {
|
||||
// CHECK-LABEL: sil hidden @{{.*}}identity
|
||||
func identity<T>(_: T) {
|
||||
// CHECK: keypath $WritableKeyPath<T, T>, <τ_0_0> ({{.*}}root $τ_0_0) <T>
|
||||
let _: WritableKeyPath<T, T> = Builtin.identityKeyPath()
|
||||
// CHECK: keypath $WritableKeyPath<Array<T>, Array<T>>, <τ_0_0> ({{.*}}root $τ_0_0) <Array<T>>
|
||||
let _: WritableKeyPath<[T], [T]> = Builtin.identityKeyPath()
|
||||
let _: WritableKeyPath<T, T> = \T.self
|
||||
// CHECK: keypath $WritableKeyPath<Array<T>, Array<T>>, <τ_0_0> ({{.*}}root $Array<τ_0_0>) <T>
|
||||
let _: WritableKeyPath<[T], [T]> = \[T].self
|
||||
// CHECK: keypath $WritableKeyPath<String, String>, ({{.*}}root $String)
|
||||
let _: WritableKeyPath<String, String> = Builtin.identityKeyPath()
|
||||
let _: WritableKeyPath<String, String> = \String.self
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user