File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1060,7 +1060,8 @@ namespace {
1060
1060
1061
1061
// Add the member constraint for a subscript declaration.
1062
1062
// FIXME: weak name!
1063
- auto memberTy = CS.createTypeVariable (memberLocator, TVO_CanBindToNoEscape);
1063
+ auto memberTy = CS.createTypeVariable (
1064
+ memberLocator, TVO_CanBindToLValue | TVO_CanBindToNoEscape);
1064
1065
1065
1066
// FIXME: synthesizeMaterializeForSet() wants to statically dispatch to
1066
1067
// a known subscript here. This might be cleaner if we split off a new
Original file line number Diff line number Diff line change @@ -2059,12 +2059,12 @@ ConstraintSystem::matchTypesBindTypeVar(
2059
2059
type.visit ([&](Type t) {
2060
2060
if (auto *tvt = dyn_cast<TypeVariableType>(t.getPointer ())) {
2061
2061
if (!typeVar->getImpl ().canBindToLValue ()) {
2062
- typeVar ->getImpl ().setCanBindToLValue (getSavedBindings (),
2063
- /* enabled=*/ false );
2062
+ tvt ->getImpl ().setCanBindToLValue (getSavedBindings (),
2063
+ /* enabled=*/ false );
2064
2064
}
2065
2065
if (!typeVar->getImpl ().canBindToNoEscape ()) {
2066
- typeVar ->getImpl ().setCanBindToNoEscape (getSavedBindings (),
2067
- /* enabled=*/ false );
2066
+ tvt ->getImpl ().setCanBindToNoEscape (getSavedBindings (),
2067
+ /* enabled=*/ false );
2068
2068
}
2069
2069
}
2070
2070
});
Original file line number Diff line number Diff line change @@ -619,7 +619,7 @@ struct WithTrailingClosure {
619
619
620
620
func keypath_with_trailing_closure_subscript( _ ty: inout SubscriptLens < WithTrailingClosure > ) {
621
621
_ = ty [ 0 ] { 42 } // expected-error {{subscript index of type '() -> Int' in a key path must be Hashable}}
622
- _ = ty [ 0 ] { 42 } = 0
622
+ _ = ty [ 0 ] { 42 } = 0 // expected-error {{cannot assign through subscript: subscript is get-only}}
623
623
// expected-error@-1 {{subscript index of type '() -> Int' in a key path must be Hashable}}
624
624
_ = ty [ ] { 42 } // expected-error {{subscript index of type '() -> Int' in a key path must be Hashable}}
625
625
_ = ty [ ] { 42 } = 0 // expected-error {{subscript index of type '() -> Int' in a key path must be Hashable}}
You can’t perform that action at this time.
0 commit comments