@@ -159,3 +159,57 @@ struct StructWithIUOinit : InitProtocol {
159
159
init !( _ x: Int ) { } // no missing-return error
160
160
}
161
161
162
+ func testSR13753( ) {
163
+ // SR-13753
164
+ let _ : ( ) -> Int = {
165
+ var x : Int {
166
+ get { 0 }
167
+ set { }
168
+ }
169
+ x // expected-error {{missing return in a closure expected to return 'Int'; did you mean to return the last expression?}} {{5-5=return }}
170
+ // expected-warning@-1 {{setter argument 'newValue' was never used, but the property was accessed}}
171
+ // expected-note@-2 {{did you mean to use 'newValue' instead of accessing the property's current value?}}
172
+ // expected-warning@-3 {{expression resolves to an unused variable}}
173
+ }
174
+
175
+ func f( ) -> Int {
176
+ var x : Int {
177
+ get { 0 }
178
+ set { }
179
+ }
180
+ x // expected-error {{missing return in a function expected to return 'Int'; did you mean to return the last expression?}} {{5-5=return }}
181
+ // expected-warning@-1 {{setter argument 'newValue' was never used, but the property was accessed}}
182
+ // expected-note@-2 {{did you mean to use 'newValue' instead of accessing the property's current value?}}
183
+ // expected-warning@-3 {{expression resolves to an unused variable}}
184
+ }
185
+
186
+ let _ : ( ) -> Int = {
187
+ var x : UInt {
188
+ get { 0 }
189
+ set { }
190
+ }
191
+ x
192
+ // expected-warning@-1 {{setter argument 'newValue' was never used, but the property was accessed}}
193
+ // expected-note@-2 {{did you mean to use 'newValue' instead of accessing the property's current value?}}
194
+ // expected-warning@-3 {{expression resolves to an unused variable}}
195
+ } // expected-error {{missing return in a closure expected to return 'Int'}}
196
+
197
+ func f1( ) -> Int {
198
+ var x : UInt {
199
+ get { 0 }
200
+ set { }
201
+ }
202
+ x
203
+ // expected-warning@-1 {{setter argument 'newValue' was never used, but the property was accessed}}
204
+ // expected-note@-2 {{did you mean to use 'newValue' instead of accessing the property's current value?}}
205
+ // expected-warning@-3 {{expression resolves to an unused variable}}
206
+ } // expected-error {{missing return in a function expected to return 'Int'}}
207
+
208
+ let _ : ( ) -> Int = {
209
+ var x : Int = 0 // expected-warning {{variable 'x' was never mutated; consider changing to 'let' constant}}
210
+ var _ : Int = 0
211
+
212
+ x // expected-error{{missing return in a closure expected to return 'Int'; did you mean to return the last expression?}} {{5-5=return }}
213
+ //expected-warning@-1{{expression resolves to an unused variable}}
214
+ }
215
+ }
0 commit comments