@@ -231,10 +231,10 @@ func testKeyPathSubscript(readonly: Z, writable: inout Z,
231
231
}
232
232
233
233
struct ZwithSubscript {
234
- subscript( keyPath: KeyPath < ZwithSubscript , Int > ) -> Int { return 0 }
235
- subscript( keyPath: WritableKeyPath < ZwithSubscript , Int > ) -> Int { return 0 }
236
- subscript( keyPath: ReferenceWritableKeyPath < ZwithSubscript , Int > ) -> Int { return 0 }
237
- subscript( keyPath: PartialKeyPath < ZwithSubscript > ) -> Any { return 0 }
234
+ subscript( keyPath kp : KeyPath < ZwithSubscript , Int > ) -> Int { return 0 }
235
+ subscript( keyPath kp : WritableKeyPath < ZwithSubscript , Int > ) -> Int { return 0 }
236
+ subscript( keyPath kp : ReferenceWritableKeyPath < ZwithSubscript , Int > ) -> Int { return 0 }
237
+ subscript( keyPath kp : PartialKeyPath < ZwithSubscript > ) -> Any { return 0 }
238
238
}
239
239
240
240
func testKeyPathSubscript( readonly: ZwithSubscript , writable: inout ZwithSubscript ,
@@ -249,12 +249,9 @@ func testKeyPathSubscript(readonly: ZwithSubscript, writable: inout ZwithSubscri
249
249
sink = readonly [ keyPath: rkp]
250
250
sink = writable [ keyPath: rkp]
251
251
252
- // FIXME: keypath application rather than subscripting if subscript parameter defined without a separate internal name
253
- readonly [ keyPath: kp] = sink // expected-error{{cannot assign to immutable expression of type 'Int'}}
254
- // FIXME: keypath application rather than subscripting if subscript parameter defined without a separate internal name
255
- writable [ keyPath: kp] = sink // expected-error{{cannot assign to immutable expression of type 'Int'}}
256
- // FIXME: keypath application rather than subscripting if subscript parameter defined without a separate internal name
257
- readonly [ keyPath: wkp] = sink // expected-error{{cannot assign to immutable expression of type 'Int'}}
252
+ readonly [ keyPath: kp] = sink // expected-error{{cannot assign through subscript: subscript is get-only}}
253
+ writable [ keyPath: kp] = sink // expected-error{{cannot assign through subscript: subscript is get-only}}
254
+ readonly [ keyPath: wkp] = sink // expected-error{{cannot assign through subscript: subscript is get-only}}
258
255
// FIXME: silently falls back to keypath application, which seems inconsistent
259
256
writable [ keyPath: wkp] = sink
260
257
// FIXME: silently falls back to keypath application, which seems inconsistent
@@ -269,10 +266,8 @@ func testKeyPathSubscript(readonly: ZwithSubscript, writable: inout ZwithSubscri
269
266
var anySink2 = writable [ keyPath: pkp]
270
267
expect ( & anySink2, toHaveType: Exactly< Any> . self )
271
268
272
- // FIXME: keypath application rather than subscripting if subscript parameter defined without a separate internal name
273
- readonly [ keyPath: pkp] = anySink1 // expected-error{{cannot assign to immutable expression of type 'Any'}}
274
- // FIXME: keypath application rather than subscripting if subscript parameter defined without a separate internal name
275
- writable [ keyPath: pkp] = anySink2 // expected-error{{cannot assign to immutable expression of type 'Any'}}
269
+ readonly [ keyPath: pkp] = anySink1 // expected-error{{cannot assign through subscript: subscript is get-only}}
270
+ writable [ keyPath: pkp] = anySink2 // expected-error{{cannot assign through subscript: subscript is get-only}}
276
271
277
272
let akp : AnyKeyPath = pkp
278
273
0 commit comments