@@ -78,24 +78,24 @@ struct ComputedB {
78
78
79
79
keyPath. test ( " key path in-place instantiation " ) {
80
80
for _ in 1 ... 2 {
81
- let s_x = ( #keyPath 2 ( S < Int > , . x ) as AnyKeyPath ) as! WritableKeyPath < S < Int > , Int >
82
- let s_y = ( #keyPath 2 ( S < Int > , . y ) as AnyKeyPath ) as! WritableKeyPath < S < Int > , LifetimeTracked ? >
83
- let s_z = ( #keyPath 2 ( S < Int > , . z ) as AnyKeyPath ) as! WritableKeyPath < S < Int > , Int >
84
- let s_p = ( #keyPath 2 ( S < Int > , . p ) as AnyKeyPath ) as! WritableKeyPath < S < Int > , Point >
85
- let s_p_x = ( #keyPath 2 ( S < Int > , . p . x) as AnyKeyPath ) as! WritableKeyPath < S < Int > , Double >
86
- let s_p_y = ( #keyPath 2 ( S < Int > , . p . y) as AnyKeyPath ) as! WritableKeyPath < S < Int > , Double >
87
- let s_c = ( #keyPath 2 ( S < Int > , . c ) as AnyKeyPath ) as! WritableKeyPath < S < Int > , C < Int > >
88
- let s_c_x = ( #keyPath 2 ( S < Int > , . c . x) as AnyKeyPath ) as! ReferenceWritableKeyPath < S < Int > , Int >
89
-
90
- let c_x = ( #keyPath 2 ( C < Int > , . x ) as AnyKeyPath ) as! ReferenceWritableKeyPath < C < Int > , Int >
81
+ let s_x = ( \ S < Int > . x as AnyKeyPath ) as! WritableKeyPath < S < Int > , Int >
82
+ let s_y = ( \ S < Int > . y as AnyKeyPath ) as! WritableKeyPath < S < Int > , LifetimeTracked ? >
83
+ let s_z = ( \ S < Int > . z as AnyKeyPath ) as! WritableKeyPath < S < Int > , Int >
84
+ let s_p = ( \ S < Int > . p as AnyKeyPath ) as! WritableKeyPath < S < Int > , Point >
85
+ let s_p_x = ( \ S < Int > . p. x as AnyKeyPath ) as! WritableKeyPath < S < Int > , Double >
86
+ let s_p_y = ( \ S < Int > . p. y as AnyKeyPath ) as! WritableKeyPath < S < Int > , Double >
87
+ let s_c = ( \ S < Int > . c as AnyKeyPath ) as! WritableKeyPath < S < Int > , C < Int > >
88
+ let s_c_x = ( \ S < Int > . c. x as AnyKeyPath ) as! ReferenceWritableKeyPath < S < Int > , Int >
89
+
90
+ let c_x = ( \ C < Int > . x as AnyKeyPath ) as! ReferenceWritableKeyPath < C < Int > , Int >
91
91
let s_c_x_2 = s_c. appending ( path: c_x)
92
92
93
93
expectEqual ( s_c_x, s_c_x_2)
94
94
expectEqual ( s_c_x_2, s_c_x)
95
95
expectEqual ( s_c_x. hashValue, s_c_x_2. hashValue)
96
96
97
- let point_x = ( #keyPath 2 ( Point, . x ) as AnyKeyPath ) as! WritableKeyPath < Point , Double >
98
- let point_y = ( #keyPath 2 ( Point, . y ) as AnyKeyPath ) as! WritableKeyPath < Point , Double >
97
+ let point_x = ( \ Point . x as AnyKeyPath ) as! WritableKeyPath < Point , Double >
98
+ let point_y = ( \ Point . y as AnyKeyPath ) as! WritableKeyPath < Point , Double >
99
99
100
100
let s_p_x_2 = s_p. appending ( path: point_x)
101
101
let s_p_y_2 = s_p. appending ( path: point_y)
@@ -107,19 +107,19 @@ keyPath.test("key path in-place instantiation") {
107
107
expectEqual ( s_p_y_2, s_p_y)
108
108
expectEqual ( s_p_y_2. hashValue, s_p_y. hashValue)
109
109
110
- let ca_readOnly = ( #keyPath 2 ( ComputedA, . readOnly) as AnyKeyPath ) as! KeyPath < ComputedA , ComputedB >
111
- let ca_nonmutating = ( #keyPath 2 ( ComputedA, . nonmutating) as AnyKeyPath ) as! ReferenceWritableKeyPath < ComputedA , ComputedB >
112
- let ca_reabstracted = ( #keyPath 2 ( ComputedA, . reabstracted) as AnyKeyPath ) as! ReferenceWritableKeyPath < ComputedA , ( ) -> ( ) >
110
+ let ca_readOnly = ( \ ComputedA . readOnly as AnyKeyPath ) as! KeyPath < ComputedA , ComputedB >
111
+ let ca_nonmutating = ( \ ComputedA . nonmutating as AnyKeyPath ) as! ReferenceWritableKeyPath < ComputedA , ComputedB >
112
+ let ca_reabstracted = ( \ ComputedA . reabstracted as AnyKeyPath ) as! ReferenceWritableKeyPath < ComputedA , ( ) -> ( ) >
113
113
114
- let cb_readOnly = ( #keyPath 2 ( ComputedB, . readOnly) as AnyKeyPath ) as! KeyPath < ComputedB , ComputedA >
115
- let cb_mutating = ( #keyPath 2 ( ComputedB, . mutating) as AnyKeyPath ) as! WritableKeyPath < ComputedB , ComputedA >
116
- let cb_nonmutating = ( #keyPath 2 ( ComputedB, . nonmutating) as AnyKeyPath ) as! ReferenceWritableKeyPath < ComputedB , ComputedA >
117
- let cb_reabstracted = ( #keyPath 2 ( ComputedB, . reabstracted) as AnyKeyPath ) as! WritableKeyPath < ComputedB , ( ) -> ( ) >
114
+ let cb_readOnly = ( \ ComputedB . readOnly as AnyKeyPath ) as! KeyPath < ComputedB , ComputedA >
115
+ let cb_mutating = ( \ ComputedB . mutating as AnyKeyPath ) as! WritableKeyPath < ComputedB , ComputedA >
116
+ let cb_nonmutating = ( \ ComputedB . nonmutating as AnyKeyPath ) as! ReferenceWritableKeyPath < ComputedB , ComputedA >
117
+ let cb_reabstracted = ( \ ComputedB . reabstracted as AnyKeyPath ) as! WritableKeyPath < ComputedB , ( ) -> ( ) >
118
118
119
- let ca_readOnly_mutating = ( #keyPath 2 ( ComputedA, . readOnly. mutating) as AnyKeyPath ) as! KeyPath < ComputedA , ComputedA >
120
- let cb_mutating_readOnly = ( #keyPath 2 ( ComputedB, . mutating. readOnly) as AnyKeyPath ) as! KeyPath < ComputedB , ComputedB >
121
- let ca_readOnly_nonmutating = ( #keyPath 2 ( ComputedA, . readOnly. nonmutating) as AnyKeyPath ) as! ReferenceWritableKeyPath < ComputedA , ComputedA >
122
- let cb_readOnly_reabstracted = ( #keyPath 2 ( ComputedB, . readOnly. reabstracted) as AnyKeyPath ) as! ReferenceWritableKeyPath < ComputedB , ( ) -> ( ) >
119
+ let ca_readOnly_mutating = ( \ ComputedA . readOnly. mutating as AnyKeyPath ) as! KeyPath < ComputedA , ComputedA >
120
+ let cb_mutating_readOnly = ( \ ComputedB . mutating. readOnly as AnyKeyPath ) as! KeyPath < ComputedB , ComputedB >
121
+ let ca_readOnly_nonmutating = ( \ ComputedA . readOnly. nonmutating as AnyKeyPath ) as! ReferenceWritableKeyPath < ComputedA , ComputedA >
122
+ let cb_readOnly_reabstracted = ( \ ComputedB . readOnly. reabstracted as AnyKeyPath ) as! ReferenceWritableKeyPath < ComputedB , ( ) -> ( ) >
123
123
124
124
let ca_readOnly_mutating2 = ca_readOnly. appending ( path: cb_mutating)
125
125
expectEqual ( ca_readOnly_mutating, ca_readOnly_mutating2)
@@ -150,24 +150,24 @@ keyPath.test("key path in-place instantiation") {
150
150
keyPath. test ( " key path generic instantiation " ) {
151
151
func testWithGenericParam< T: Equatable > ( _: T . Type ) -> ReferenceWritableKeyPath < S < T > , Int > {
152
152
for i in 1 ... 2 {
153
- let s_x = ( #keyPath 2 ( S < T > , . x ) as AnyKeyPath ) as! WritableKeyPath < S < T > , Int >
154
- let s_y = ( #keyPath 2 ( S < T > , . y ) as AnyKeyPath ) as! WritableKeyPath < S < T > , LifetimeTracked ? >
155
- let s_z = ( #keyPath 2 ( S < T > , . z ) as AnyKeyPath ) as! WritableKeyPath < S < T > , T >
156
- let s_p = ( #keyPath 2 ( S < T > , . p ) as AnyKeyPath ) as! WritableKeyPath < S < T > , Point >
157
- let s_p_x = ( #keyPath 2 ( S < T > , . p . x) as AnyKeyPath ) as! WritableKeyPath < S < T > , Double >
158
- let s_p_y = ( #keyPath 2 ( S < T > , . p . y) as AnyKeyPath ) as! WritableKeyPath < S < T > , Double >
159
- let s_c = ( #keyPath 2 ( S < T > , . c ) as AnyKeyPath ) as! WritableKeyPath < S < T > , C < T > >
160
- let s_c_x = ( #keyPath 2 ( S < T > , . c . x) as AnyKeyPath ) as! ReferenceWritableKeyPath < S < T > , Int >
161
-
162
- let c_x = ( #keyPath 2 ( C < T > , . x ) as AnyKeyPath ) as! ReferenceWritableKeyPath < C < T > , Int >
153
+ let s_x = ( \ S < T > . x as AnyKeyPath ) as! WritableKeyPath < S < T > , Int >
154
+ let s_y = ( \ S < T > . y as AnyKeyPath ) as! WritableKeyPath < S < T > , LifetimeTracked ? >
155
+ let s_z = ( \ S < T > . z as AnyKeyPath ) as! WritableKeyPath < S < T > , T >
156
+ let s_p = ( \ S < T > . p as AnyKeyPath ) as! WritableKeyPath < S < T > , Point >
157
+ let s_p_x = ( \ S < T > . p. x as AnyKeyPath ) as! WritableKeyPath < S < T > , Double >
158
+ let s_p_y = ( \ S < T > . p. y as AnyKeyPath ) as! WritableKeyPath < S < T > , Double >
159
+ let s_c = ( \ S < T > . c as AnyKeyPath ) as! WritableKeyPath < S < T > , C < T > >
160
+ let s_c_x = ( \ S < T > . c. x as AnyKeyPath ) as! ReferenceWritableKeyPath < S < T > , Int >
161
+
162
+ let c_x = ( \ C < T > . x as AnyKeyPath ) as! ReferenceWritableKeyPath < C < T > , Int >
163
163
let s_c_x_2 = s_c. appending ( path: c_x)
164
164
165
165
expectEqual ( s_c_x, s_c_x_2)
166
166
expectEqual ( s_c_x_2, s_c_x)
167
167
expectEqual ( s_c_x. hashValue, s_c_x_2. hashValue)
168
168
169
- let point_x = ( #keyPath 2 ( Point, . x ) as AnyKeyPath ) as! WritableKeyPath < Point , Double >
170
- let point_y = ( #keyPath 2 ( Point, . y ) as AnyKeyPath ) as! WritableKeyPath < Point , Double >
169
+ let point_x = ( \ Point . x as AnyKeyPath ) as! WritableKeyPath < Point , Double >
170
+ let point_y = ( \ Point . y as AnyKeyPath ) as! WritableKeyPath < Point , Double >
171
171
172
172
let s_p_x_2 = s_p. appending ( path: point_x)
173
173
let s_p_y_2 = s_p. appending ( path: point_y)
@@ -184,15 +184,15 @@ keyPath.test("key path generic instantiation") {
184
184
fatalError ( )
185
185
}
186
186
let s_c_x_int = testWithGenericParam ( Int . self)
187
- let s_c_x_int2 = #keyPath 2 ( S < Int > , . c . x)
187
+ let s_c_x_int2 = \ S < Int > . c. x
188
188
expectEqual ( s_c_x_int, s_c_x_int2)
189
189
190
190
let s_c_x_string = testWithGenericParam ( String . self)
191
- let s_c_x_string2 = #keyPath 2 ( S < String > , . c . x)
191
+ let s_c_x_string2 = \ S < String > . c. x
192
192
expectEqual ( s_c_x_string, s_c_x_string2)
193
193
194
194
let s_c_x_lt = testWithGenericParam ( LifetimeTracked . self)
195
- let s_c_x_lt2 = #keyPath 2 ( S < LifetimeTracked > , . c . x)
195
+ let s_c_x_lt2 = \ S < LifetimeTracked > . c. x
196
196
expectEqual ( s_c_x_lt, s_c_x_lt2)
197
197
}
198
198
0 commit comments