You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
set{} // expected-error {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
52
+
}
53
+
}
54
+
55
+
structBadSubscript2{
56
+
subscript(_ i :Int)->Int{
57
+
get throws{}
58
+
59
+
// expected-error@+2 {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
60
+
// expected-error@+1 {{'set' accessor cannot have specifier 'throws'}}
61
+
set throws {}
62
+
}
63
+
}
64
+
65
+
structS{
66
+
varprop2:Int{
67
+
mutating get asyncthrows{0}
68
+
nonmutating set{} // expected-error {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
69
+
}
70
+
}
71
+
72
+
varprop3:Bool{
73
+
// expected-error@+2 {{'_read' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
74
+
// expected-error@+1 {{variable cannot provide both a 'read' accessor and a getter}}
75
+
_read{ yield prop3 }
76
+
77
+
// expected-note@+2 {{getter defined here}}
78
+
// expected-note@+1 2 {{previous definition of getter here}}
79
+
get throws {false}
80
+
get async{true} // expected-error{{variable already has a getter}}
81
+
82
+
get{} // expected-error{{variable already has a getter}}
83
+
}
84
+
85
+
enumE{
86
+
private(set)varprop4:Double{
87
+
set{} // expected-error {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
88
+
get asyncthrows{1.1}
89
+
_modify{ yield &prop4 } // expected-error {{'_modify' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
90
+
}
91
+
}
92
+
93
+
protocolP{
94
+
associatedtypeT
95
+
varprop1:T{get asyncthrows}
96
+
varprop2:T{get asyncthrowsset} // expected-error {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
97
+
varprop3:T{get throwsset} // expected-error {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
98
+
varprop4:T{get async}
99
+
varprop5:T{mutating get asyncthrows}
100
+
varprop6:T{mutating get throws}
101
+
varprop7:T{mutating get asyncnonmutating set} // expected-error {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
102
+
}
103
+
104
+
///////////////////
105
+
// invalid syntax
106
+
107
+
varbad1:Int{
108
+
get rethrows{0} // expected-error{{only function declarations may be marked 'rethrows'; did you mean 'throws'?}}
109
+
110
+
// expected-error@+1 {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
111
+
set rethrows {} // expected-error{{'set' accessor cannot have specifier 'rethrows'}}
112
+
}
113
+
114
+
varbad2:Int{
115
+
get reasync{0} // expected-error{{only function declarations may be marked 'reasync'; did you mean 'async'?}}
116
+
117
+
// expected-error@+1 {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
118
+
set reasync{} // expected-error{{'set' accessor cannot have specifier 'reasync'}}
0 commit comments