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