@@ -324,8 +324,8 @@ func testKeyPathSubscript(readonly: Z, writable: inout Z,
324
324
var anySink2 = writable [ keyPath: pkp]
325
325
expect ( & anySink2, toHaveType: Exactly< Any> . self )
326
326
327
- readonly [ keyPath: pkp] = anySink1 // expected-error{{cannot assign through subscript: 'readonly ' is a 'let' constant }}
328
- writable [ keyPath: pkp] = anySink2 // expected-error{{cannot assign through subscript: 'writable ' is immutable }}
327
+ readonly [ keyPath: pkp] = anySink1 // expected-error{{cannot assign through subscript: 'pkp ' is a read-only key path }}
328
+ writable [ keyPath: pkp] = anySink2 // expected-error{{cannot assign through subscript: 'pkp ' is a read-only key path }}
329
329
330
330
let akp : AnyKeyPath = pkp
331
331
@@ -443,12 +443,12 @@ func testKeyPathSubscriptLValue(base: Z, kp: inout KeyPath<Z, Z>) {
443
443
}
444
444
445
445
func testKeyPathSubscriptExistentialBase( concreteBase: inout B ,
446
- existentialBase: inout P ,
447
- kp: KeyPath < P , String > ,
448
- wkp: WritableKeyPath < P , String > ,
449
- rkp: ReferenceWritableKeyPath < P , String > ,
450
- pkp: PartialKeyPath < P > ,
451
- s: String ) {
446
+ existentialBase: inout P ,
447
+ kp: KeyPath < P , String > ,
448
+ wkp: WritableKeyPath < P , String > ,
449
+ rkp: ReferenceWritableKeyPath < P , String > ,
450
+ pkp: PartialKeyPath < P > ,
451
+ s: String ) {
452
452
_ = concreteBase [ keyPath: kp]
453
453
_ = concreteBase [ keyPath: wkp]
454
454
_ = concreteBase [ keyPath: rkp]
@@ -457,9 +457,7 @@ func testKeyPathSubscriptExistentialBase(concreteBase: inout B,
457
457
concreteBase [ keyPath: kp] = s // expected-error {{cannot assign through subscript: 'kp' is a read-only key path}}
458
458
concreteBase [ keyPath: wkp] = s // expected-error {{key path with root type 'P' cannot be applied to a base of type 'B'}}
459
459
concreteBase [ keyPath: rkp] = s
460
- // TODO(diagnostics): Improve this diagnostic message because concreteBase is mutable, the problem is related to assign
461
- // through PartialKeyPath.
462
- concreteBase [ keyPath: pkp] = s // expected-error {{cannot assign through subscript: 'concreteBase' is immutable}}
460
+ concreteBase [ keyPath: pkp] = s // expected-error {{cannot assign through subscript: 'pkp' is a read-only key path}}
463
461
464
462
_ = existentialBase [ keyPath: kp]
465
463
_ = existentialBase [ keyPath: wkp]
@@ -469,9 +467,7 @@ func testKeyPathSubscriptExistentialBase(concreteBase: inout B,
469
467
existentialBase [ keyPath: kp] = s // expected-error {{cannot assign through subscript: 'kp' is a read-only key path}}
470
468
existentialBase [ keyPath: wkp] = s
471
469
existentialBase [ keyPath: rkp] = s
472
- // TODO(diagnostics): Improve this diagnostic message because existentialBase is mutable, the problem is related to assign
473
- // through PartialKeyPath.
474
- existentialBase [ keyPath: pkp] = s // expected-error {{cannot assign through subscript: 'existentialBase' is immutable}}
470
+ existentialBase [ keyPath: pkp] = s // expected-error {{cannot assign through subscript: 'pkp' is a read-only key path}}
475
471
}
476
472
477
473
struct AA {
0 commit comments