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/Parse/invalid.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -119,7 +119,7 @@ prefix func %<T>(x: T) -> T { return x } // No error expected - the < is conside
119
119
120
120
structWeak<T:class>{ // expected-error {{'class' constraint can only appear on protocol declarations}}
121
121
// expected-note@-1 {{did you mean to write an 'AnyObject' constraint?}} {{16-21=AnyObject}}
122
-
weak letvalue:T // expected-error {{'weak' must be a mutable variable, because it may change at runtime}} expected-error {{'weak' variable should have optional type 'T?'}} expected-error {{'weak' must not be applied to non-class-bound 'T'; consider adding a protocol conformance that has a class bound}}
122
+
weak letvalue:T // expected-error {{'weak' variable should have optional type 'T?'}} expected-error {{'weak' must not be applied to non-class-bound 'T'; consider adding a protocol conformance that has a class bound}}
Copy file name to clipboardExpand all lines: test/expr/closure/closures.swift
+17-16Lines changed: 17 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -262,12 +262,12 @@ class ExplicitSelfRequiredTest {
262
262
// because its `sawError` flag is set to true. To preserve the "capture 'y' was never used" warnings
263
263
// above, we put these cases in their own method.
264
264
func weakSelfError(){
265
-
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}}
266
-
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}}
267
-
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}}
268
-
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}}
269
-
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}}
270
-
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}}
265
+
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 {{capture 'self' was never used}}
266
+
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 {{capture 'self' was never used}}
267
+
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 {{capture 'self' was never used}}
268
+
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 {{capture 'self' was never used}}
269
+
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 {{capture 'self' was never used}}
270
+
doStuff({[weak self]inmethod()}) // expected-error {{call to method 'method' in closure requires explicit use of 'self' to make capture semantics explicit}} expected-warning {{capture 'self' was never used}}
271
271
}
272
272
}
273
273
@@ -374,7 +374,7 @@ extension SomeClass {
374
374
//expected-error@-3{{reference to property 'in' in closure requires explicit use of 'self' to make capture semantics explicit}}
@@ -1522,21 +1523,21 @@ final class AutoclosureTests {
1522
1523
}
1523
1524
}
1524
1525
1525
-
doVoidStuff{[weak self]in // expected-warning {{variable 'self' was written to, but never read}}
1526
+
doVoidStuff{[weak self]in // expected-warning {{capture 'self' was never used}}
1526
1527
withNonEscapingAutoclosure(bar()) // expected-error {{call to method 'bar' in closure requires explicit use of 'self' to make capture semantics explicit}}
1527
1528
}
1528
1529
1529
-
doVoidStuff{[weak self]in // expected-warning {{variable 'self' was written to, but never read}}
1530
+
doVoidStuff{[weak self]in // expected-warning {{capture 'self' was never used}}
1530
1531
withEscapingAutoclosure(bar()) // expected-error {{call to method 'bar' in closure requires explicit use of 'self' to make capture semantics explicit}} expected-note {{reference 'self.' explicitly}}
1531
1532
}
1532
1533
1533
-
doVoidStuff{[weak self]in // expected-warning {{variable 'self' was written to, but never read}}
1534
+
doVoidStuff{[weak self]in // expected-warning {{capture 'self' was never used}}
1534
1535
doVoidStuff{ // expected-note {{capture 'self' explicitly to enable implicit 'self' in this closure}}
1535
1536
withNonEscapingAutoclosure(bar()) // expected-error {{all to method 'bar' in closure requires explicit use of 'self' to make capture semantics explicit}} expected-note {{reference 'self.' explicitly}}
1536
1537
}
1537
1538
}
1538
1539
1539
-
doVoidStuff{[weak self]in // expected-warning {{variable 'self' was written to, but never read}}
1540
+
doVoidStuff{[weak self]in // expected-warning {{capture 'self' was never used}}
1540
1541
doVoidStuff{
1541
1542
withEscapingAutoclosure(bar()) // expected-error {{call to method 'bar' in closure requires explicit use of 'self' to make capture semantics explicit}} expected-note {{reference 'self.' explicitly}}
1542
1543
}
@@ -1771,21 +1772,21 @@ class rdar129475277 {
1771
1772
func method(){}
1772
1773
1773
1774
func test1(){
1774
-
takesEscapingWithAllowedImplicitSelf{[weak self]in // expected-warning {{variable 'self' was written to, but never read}}
1775
+
takesEscapingWithAllowedImplicitSelf{[weak self]in // expected-warning {{capture 'self' was never used}}
1775
1776
takesEscapingWithAllowedImplicitSelf{
1776
1777
method() // expected-warning {{call to method 'method' in closure requires explicit use of 'self' to make capture semantics explicit}}
1777
1778
}
1778
1779
}
1779
1780
1780
-
takesEscapingWithAllowedImplicitSelf{[weak self]in // expected-warning {{variable 'self' was written to, but never read}}
1781
+
takesEscapingWithAllowedImplicitSelf{[weak self]in // expected-warning {{capture 'self' was never used}}
1781
1782
takesEscapingWithAllowedImplicitSelf{
1782
1783
doVoidStuffNonEscaping{
1783
1784
withNonEscapingAutoclosure(bar()) // expected-warning {{call to method 'bar' in closure requires explicit use of 'self' to make capture semantics explicit}}
1784
1785
}
1785
1786
}
1786
1787
}
1787
1788
1788
-
takesEscapingWithAllowedImplicitSelf{[weak self]in // expected-warning {{variable 'self' was written to, but never read}}
1789
+
takesEscapingWithAllowedImplicitSelf{[weak self]in // expected-warning {{capture 'self' was never used}}
1789
1790
withNonEscapingAutoclosure(bar()) // expected-warning {{call to method 'bar' in closure requires explicit use of 'self' to make capture semantics explicit}}
1790
1791
}
1791
1792
}
@@ -1818,15 +1819,15 @@ class TestExtensionOnOptionalSelf {
1818
1819
1819
1820
extensionTestExtensionOnOptionalSelf?{
1820
1821
func foo(){
1821
-
_ ={[weak self]in // expected-warning {{variable 'self' was written to, but never read}}
1822
+
_ ={[weak self]in // expected-warning {{capture 'self' was never used}}
1822
1823
foo() // expected-error {{call to method 'foo' in closure requires explicit use of 'self' to make capture semantics explicit}}
1823
1824
}
1824
1825
1825
1826
_ ={
1826
1827
foo()
1827
1828
}
1828
1829
1829
-
_ ={[weak self]in // expected-warning {{variable 'self' was written to, but never read}}
1830
+
_ ={[weak self]in // expected-warning {{capture 'self' was never used}}
0 commit comments