File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -15229,7 +15229,12 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
15229
15229
locator.endsWith<LocatorPathElt::SubscriptMember>())
15230
15230
? 1
15231
15231
: 0;
15232
-
15232
+ // An overload choice that isn't settable is least interesting for diagnosis.
15233
+ if (auto overload = findSelectedOverloadFor(getCalleeLocator(fix->getLocator()))) {
15234
+ if (auto *var = dyn_cast_or_null<VarDecl>(overload->choice.getDeclOrNull())) {
15235
+ impact += !var->isSettableInSwift(DC) ? 1 : 0;
15236
+ }
15237
+ }
15233
15238
return recordFix(fix, impact) ? SolutionKind::Error : SolutionKind::Solved;
15234
15239
}
15235
15240
Original file line number Diff line number Diff line change @@ -762,3 +762,16 @@ struct S2<T> {
762
762
// expected-note@-1 {{add explicit 'S2<T>.' to refer to mutable static property of 'S2<T>'}} {{5-5=S2<T>.}}
763
763
}
764
764
}
765
+
766
+ // SR-3680, https://github.com/apple/swift/issues/46265
767
+ protocol HasFoo {
768
+ var foo : String { get }
769
+ }
770
+ protocol CanSetFoo {
771
+ var foo : String { get set }
772
+ }
773
+ extension HasFoo where Self: CanSetFoo {
774
+ func bar( ) { // expected-note {{mark method 'mutating' to make 'self' mutable}}{{3-3=mutating }}
775
+ self . foo = " bar " // expected-error {{cannot assign to property: 'self' is immutable}}
776
+ }
777
+ }
You can’t perform that action at this time.
0 commit comments