File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -63,19 +63,16 @@ Swift Next
63
63
extension Foo where Self : Bar {
64
64
var anotherProperty1: Int {
65
65
get { return someProperty }
66
- // 'someProperty' exists as a protocol requirement (implicitly mutating
67
- // due to the lack of a class constraint), so the setter below needs to
68
- // be explicitly marked as 'mutating'.
69
- set { someProperty = newValue } // Error
70
- }
71
-
72
- var anotherProperty2: Int {
73
- get { return someProperty }
74
- mutating set { someProperty = newValue } // Okay
66
+ // This will now error, because the protocol requirement
67
+ // is implicitly mutating and the setter is implicitly
68
+ // nonmutating.
69
+ set { someProperty = newValue }
75
70
}
76
71
}
77
72
```
78
73
74
+ To resolve this, explicitly mark the setter as ` nonmutating ` in the protocol.
75
+
79
76
* [ SE-0253] [ ] :
80
77
81
78
Values of types that declare ` func callAsFunction ` methods can be called
You can’t perform that action at this time.
0 commit comments