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:
Joe Groff
2018-09-18 19:05:41 -07:00
parent 86e11c594f
commit 93b5de61e7
21 changed files with 115 additions and 110 deletions

View File

@@ -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
}