Skip to content

Commit 1f8e101

Browse files
authored
Apply @storageRestrictions only to init accessors (#2099)
1 parent 51f3fbe commit 1f8e101

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

proposals/0400-init-accessors.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ struct S {
237237
var x1: Int
238238
var x2: Int
239239

240-
@storageRestrictions(initializes: x1, x2)
241240
var computed: Int {
241+
@storageRestrictions(initializes: x1, x2)
242242
init(newValue) { ... }
243243
}
244244

@@ -255,8 +255,8 @@ struct S {
255255
var x: Int
256256
var y: Int
257257

258-
@storageRestrictions(initializes: x, y)
259258
var point: (Int, Int) {
259+
@storageRestrictions(initializes: x, y)
260260
init(newValue) {
261261
(self.x, self.y) = newValue
262262
}
@@ -286,8 +286,8 @@ struct S {
286286
var x2: Int
287287
var x3: Int
288288

289-
@storageRestrictions(initializes: x1, x2)
290289
var computed: Int {
290+
@storageRestrictions(initializes: x1, x2)
291291
init(newValue) { ... }
292292
}
293293

@@ -306,10 +306,10 @@ struct S {
306306
var x: Int
307307
var y: Int
308308

309-
@storageRestrictions(initializes: x, y)
310309
var point: (Int, Int) {
310+
@storageRestrictions(initializes: x, y)
311311
init(newValue) {
312-
(self.x, self.y) = newValue
312+
(self.x, self.y) = newValue
313313
}
314314
get { (x, y) }
315315
set { (x, y) = newValue }
@@ -330,8 +330,8 @@ If a struct does not declare its own initializers, it receives an implicit membe
330330
struct S {
331331
var _x: Int
332332

333-
@storageRestrictions(initializes: _x)
334333
var x: Int {
334+
@storageRestrictions(initializes: _x)
335335
init(newValue) {
336336
_x = newValue
337337
}
@@ -361,8 +361,8 @@ The parameters of the memberwise initializer follow source order. However, if an
361361
struct S {
362362
var _x: Int
363363

364-
@storageRestrictions(initializes: _x, accesses: y)
365364
var x: Int {
365+
@storageRestrictions(initializes: _x, accesses: y)
366366
init(newValue) {
367367
_x = newValue
368368
}
@@ -433,8 +433,8 @@ Init accessors can be provided for properties that lack a setter. Such propertie
433433
struct S {
434434
var _x: Int
435435

436-
@storageRestrictions(initializes: _x)
437436
var x: Int {
437+
@storageRestrictions(initializes: _x)
438438
init(initialValue) {
439439
self._x = x
440440
}

0 commit comments

Comments
 (0)