File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,30 @@ extension DoesNotImposeClassReq_2 where Self : AnyObject {
227
227
}
228
228
}
229
229
230
+ protocol DoesNotImposeClassReq_3 {
231
+ var someProperty : Int { get set }
232
+ }
233
+
234
+ class JustAClass1 : DoesNotImposeClassReq_3 {
235
+ var someProperty = 0
236
+ }
237
+
238
+ extension DoesNotImposeClassReq_3 where Self: JustAClass1 {
239
+ var anotherProperty1 : Int {
240
+ get { return someProperty }
241
+ set { someProperty = newValue } // Okay
242
+ }
243
+
244
+ var anotherProperty2 : Int {
245
+ get { return someProperty }
246
+ set { someProperty = newValue } // Okay
247
+ }
248
+ }
249
+
250
+ let justAClass1 = JustAClass1 ( ) // expected-note {{change 'let' to 'var' to make it mutable}}
251
+ justAClass1. anotherProperty1 = 1234 // Okay
252
+ justAClass1. anotherProperty2 = 4321 // expected-error {{cannot assign to property: 'justAClass1' is a 'let' constant}}
253
+
230
254
// Reject extension of nominal type via parameterized typealias
231
255
232
256
struct Nest < Egg> { typealias Contents = Egg }
You can’t perform that action at this time.
0 commit comments