File tree Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Original file line number Diff line number Diff line change @@ -80,40 +80,6 @@ Swift 5.2
80
80
}
81
81
}
82
82
```
83
-
84
- As a result, this could lead to code that currently compiles today to throw an error.
85
-
86
- ``` swift
87
- protocol Foo {
88
- var someProperty: Int { get set }
89
- }
90
-
91
- class Bar : Foo {
92
- var someProperty = 0
93
- }
94
-
95
- extension Foo where Self : Bar {
96
- var anotherProperty1: Int {
97
- get { return someProperty }
98
- // This will now error, because the protocol requirement
99
- // is implicitly mutating and the setter is implicitly
100
- // nonmutating.
101
- set { someProperty = newValue } // Error
102
- }
103
- }
104
- ```
105
-
106
- ** Workaround** : Define a new mutable variable inside the setter that has a reference to ` self ` :
107
-
108
- ``` swift
109
- var anotherProperty1: Int {
110
- get { return someProperty }
111
- set {
112
- var mutableSelf = self
113
- mutableSelf.someProperty = newValue // Okay
114
- }
115
- }
116
- ```
117
83
118
84
* [ SE-0253] [ ] :
119
85
You can’t perform that action at this time.
0 commit comments