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
Copy file name to clipboardExpand all lines: test/expr/closure/closures.swift
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -261,12 +261,12 @@ class ExplicitSelfRequiredTest {
261
261
// because its `sawError` flag is set to true. To preserve the "capture 'y' was never used" warnings
262
262
// above, we put these cases in their own method.
263
263
func weakSelfError(){
264
-
doVoidStuff({[weak self]in x +=1}) // expected-error {{reference to property 'x' in closure requires explicit use of 'self' to make capture semantics explicit}}
265
-
doVoidStuffNonEscaping({[weak self]in x +=1}) // expected-warning {{reference to property 'x' in closure requires explicit use of 'self' to make capture semantics explicit}}
266
-
doStuff({[weak self]in x+1}) // expected-error {{reference to property 'x' in closure requires explicit use of 'self' to make capture semantics explicit}}
267
-
doVoidStuff({[weak self]in _ =method()}) // expected-error {{call to method 'method' in closure requires explicit use of 'self' to make capture semantics explicit}}
268
-
doVoidStuffNonEscaping({[weak self]in _ =method()}) // expected-warning {{call to method 'method' in closure requires explicit use of 'self' to make capture semantics explicit}}
269
-
doStuff({[weak self]inmethod()}) // expected-error {{call to method 'method' in closure requires explicit use of 'self' to make capture semantics explicit}}
264
+
doVoidStuff({[weak self]in x +=1}) // expected-error {{reference to property 'x' in closure requires explicit use of 'self' to make capture semantics explicit}} expected-warning {{variable 'self' was written to, but never read}}
265
+
doVoidStuffNonEscaping({[weak self]in x +=1}) // expected-warning {{reference to property 'x' in closure requires explicit use of 'self' to make capture semantics explicit}} expected-warning {{variable 'self' was written to, but never read}}
266
+
doStuff({[weak self]in x+1}) // expected-error {{reference to property 'x' in closure requires explicit use of 'self' to make capture semantics explicit}} expected-warning {{variable 'self' was written to, but never read}}
267
+
doVoidStuff({[weak self]in _ =method()}) // expected-error {{call to method 'method' in closure requires explicit use of 'self' to make capture semantics explicit}} expected-warning {{variable 'self' was written to, but never read}}
268
+
doVoidStuffNonEscaping({[weak self]in _ =method()}) // expected-warning {{call to method 'method' in closure requires explicit use of 'self' to make capture semantics explicit}} expected-warning {{variable 'self' was written to, but never read}}
269
+
doStuff({[weak self]inmethod()}) // expected-error {{call to method 'method' in closure requires explicit use of 'self' to make capture semantics explicit}} expected-warning {{variable 'self' was written to, but never read}}
270
270
}
271
271
}
272
272
@@ -775,7 +775,7 @@ public class TestImplicitSelfForWeakSelfCapture {
guardlet self =self??TestImplicitSelfForWeakSelfCapture.staticOptional else{return} // expected-warning {{value 'self' was defined but never used; consider replacing with boolean test}}
779
779
method() // expected-error {{call to method 'method' in closure requires explicit use of 'self' to make capture semantics explicit}}
780
780
}
781
781
@@ -811,7 +811,7 @@ public class TestImplicitSelfForWeakSelfCapture {
guardlet self =self??TestImplicitSelfForWeakSelfCapture.staticOptional else{return} // value 'self' was defined but never used; consider replacing with boolean test
815
815
method() // expected-warning {{call to method 'method' in closure requires explicit use of 'self' to make capture semantics explicit}}
0 commit comments