3
3
// ---------------------------------------------------------------------------
4
4
// Property delegate type definitions
5
5
// ---------------------------------------------------------------------------
6
- @propertyDelegate
6
+ @_propertyDelegate
7
7
struct Wrapper < T> {
8
8
var value : T
9
9
}
10
10
11
- @propertyDelegate
11
+ @_propertyDelegate
12
12
struct WrapperWithInitialValue < T> {
13
13
var value : T
14
14
@@ -17,7 +17,7 @@ struct WrapperWithInitialValue<T> {
17
17
}
18
18
}
19
19
20
- @propertyDelegate
20
+ @_propertyDelegate
21
21
struct WrapperAcceptingAutoclosure < T> {
22
22
private let fn : ( ) -> T
23
23
@@ -34,30 +34,30 @@ struct WrapperAcceptingAutoclosure<T> {
34
34
}
35
35
}
36
36
37
- @propertyDelegate
37
+ @_propertyDelegate
38
38
struct MissingValue < T> { }
39
39
// expected-error@-1{{property delegate type 'MissingValue' does not contain a non-static property named 'value'}}
40
40
41
- @propertyDelegate
41
+ @_propertyDelegate
42
42
struct StaticValue {
43
43
static var value : Int = 17
44
44
}
45
45
// expected-error@-3{{property delegate type 'StaticValue' does not contain a non-static property named 'value'}}
46
46
47
47
48
- // expected-error@+1{{'@propertyDelegate ' attribute cannot be applied to this declaration}}
49
- @propertyDelegate
48
+ // expected-error@+1{{'@_propertyDelegate ' attribute cannot be applied to this declaration}}
49
+ @_propertyDelegate
50
50
protocol CannotBeADelegate {
51
51
associatedtype Value
52
52
var value : Value { get set }
53
53
}
54
54
55
- @propertyDelegate
55
+ @_propertyDelegate
56
56
struct NonVisibleValueDelegate < Value> {
57
57
private var value : Value // expected-error{{private property 'value' cannot have more restrictive access than its enclosing property delegate type 'NonVisibleValueDelegate' (which is internal)}}
58
58
}
59
59
60
- @propertyDelegate
60
+ @_propertyDelegate
61
61
struct NonVisibleInitDelegate < Value> {
62
62
var value : Value
63
63
@@ -66,7 +66,7 @@ struct NonVisibleInitDelegate<Value> {
66
66
}
67
67
}
68
68
69
- @propertyDelegate
69
+ @_propertyDelegate
70
70
struct InitialValueTypeMismatch < Value> {
71
71
var value : Value // expected-note{{'value' declared here}}
72
72
@@ -75,7 +75,7 @@ struct InitialValueTypeMismatch<Value> {
75
75
}
76
76
}
77
77
78
- @propertyDelegate
78
+ @_propertyDelegate
79
79
struct MultipleInitialValues < Value> { // expected-error{{property delegate type 'MultipleInitialValues' has multiple initial-value initializers}}
80
80
var value : Value ? = nil
81
81
@@ -86,7 +86,7 @@ struct MultipleInitialValues<Value> { // expected-error{{property delegate type
86
86
}
87
87
}
88
88
89
- @propertyDelegate
89
+ @_propertyDelegate
90
90
struct InitialValueFailable < Value> {
91
91
var value : Value
92
92
@@ -95,7 +95,7 @@ struct InitialValueFailable<Value> {
95
95
}
96
96
}
97
97
98
- @propertyDelegate
98
+ @_propertyDelegate
99
99
struct InitialValueFailableIUO < Value> {
100
100
var value : Value
101
101
@@ -107,12 +107,12 @@ struct InitialValueFailableIUO<Value> {
107
107
// ---------------------------------------------------------------------------
108
108
// Property delegate type definitions
109
109
// ---------------------------------------------------------------------------
110
- @propertyDelegate
110
+ @_propertyDelegate
111
111
struct _lowercaseDelegate < T> { // expected-error{{property delegate type name must start with an uppercase letter}}
112
112
var value : T
113
113
}
114
114
115
- @propertyDelegate
115
+ @_propertyDelegate
116
116
struct _UppercaseDelegate < T> {
117
117
var value : T
118
118
}
@@ -228,17 +228,17 @@ struct Initialization {
228
228
// ---------------------------------------------------------------------------
229
229
// Delegate type formation
230
230
// ---------------------------------------------------------------------------
231
- @propertyDelegate
231
+ @_propertyDelegate
232
232
struct IntWrapper {
233
233
var value : Int
234
234
}
235
235
236
- @propertyDelegate
236
+ @_propertyDelegate
237
237
struct WrapperForHashable < T: Hashable > {
238
238
var value : T
239
239
}
240
240
241
- @propertyDelegate
241
+ @_propertyDelegate
242
242
struct WrapperWithTwoParams < T, U> {
243
243
var value : ( T , U )
244
244
}
@@ -270,7 +270,7 @@ struct UseWrappersWithDifferentForm {
270
270
// Nested delegates
271
271
// ---------------------------------------------------------------------------
272
272
struct HasNestedDelegate < T> {
273
- @propertyDelegate
273
+ @_propertyDelegate
274
274
struct NestedDelegate < U> {
275
275
var value : U
276
276
init ( initialValue: U ) {
@@ -367,7 +367,7 @@ struct UseWillSetDidSet {
367
367
// ---------------------------------------------------------------------------
368
368
// Mutating/nonmutating
369
369
// ---------------------------------------------------------------------------
370
- @propertyDelegate
370
+ @_propertyDelegate
371
371
struct DelegateWithNonMutatingSetter < Value> {
372
372
class Box {
373
373
var value : Value
@@ -388,7 +388,7 @@ struct DelegateWithNonMutatingSetter<Value> {
388
388
}
389
389
}
390
390
391
- @propertyDelegate
391
+ @_propertyDelegate
392
392
struct DelegateWithMutatingGetter < Value> {
393
393
var readCount = 0
394
394
var writeCount = 0
@@ -410,7 +410,7 @@ struct DelegateWithMutatingGetter<Value> {
410
410
}
411
411
}
412
412
413
- @propertyDelegate
413
+ @_propertyDelegate
414
414
class ClassDelegate < Value> {
415
415
var value : Value
416
416
@@ -469,7 +469,7 @@ func testMutatingness() {
469
469
// Access control
470
470
// ---------------------------------------------------------------------------
471
471
struct HasPrivateDelegate < T> {
472
- @propertyDelegate
472
+ @_propertyDelegate
473
473
private struct PrivateDelegate < U> { // expected-note{{type declared here}}
474
474
var value : U
475
475
init ( initialValue: U ) {
@@ -487,7 +487,7 @@ struct HasPrivateDelegate<T> {
487
487
}
488
488
489
489
public struct HasUsableFromInlineDelegate < T> {
490
- @propertyDelegate
490
+ @_propertyDelegate
491
491
struct InternalDelegate < U> { // expected-note{{type declared here}}
492
492
var value : U
493
493
init ( initialValue: U ) {
@@ -501,7 +501,7 @@ public struct HasUsableFromInlineDelegate<T> {
501
501
// expected-error@-1{{property delegate type referenced from a '@usableFromInline' property must be '@usableFromInline' or public}}
502
502
}
503
503
504
- @propertyDelegate
504
+ @_propertyDelegate
505
505
class Box < Value> {
506
506
private( set) var value : Value
507
507
@@ -613,7 +613,7 @@ func testDefaultInitializers() {
613
613
// ---------------------------------------------------------------------------
614
614
// Storage references
615
615
// ---------------------------------------------------------------------------
616
- @propertyDelegate
616
+ @_propertyDelegate
617
617
struct WrapperWithStorageRef < T> {
618
618
var value : T
619
619
@@ -652,7 +652,7 @@ func testStorageRef(tsr: TestStorageRef) {
652
652
// ---------------------------------------------------------------------------
653
653
// Misc. semantic issues
654
654
// ---------------------------------------------------------------------------
655
- @propertyDelegate
655
+ @_propertyDelegate
656
656
struct BrokenLazy { }
657
657
// expected-error@-1{{property delegate type 'BrokenLazy' does not contain a non-static property named 'value'}}
658
658
// expected-note@-2{{'BrokenLazy' declared here}}
0 commit comments