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
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -136,9 +136,9 @@ class ExplicitSelfRequiredTest {
136
136
varx=42
137
137
func method()->Int{
138
138
// explicit closure requires an explicit "self." base.
139
-
doStuff({++self.x })
140
-
doStuff({++x}) // expected-error {{reference to property 'x' in closure requires explicit 'self.' to make capture semantics explicit}} {{17-17=self.}}
141
-
doVoidStuff({++x }) // expected-error {{reference to property 'x' in closure requires explicit 'self.' to make capture semantics explicit}} {{21-21=self.}}
139
+
doVoidStuff({self.x+=1})
140
+
doStuff({x+1}) // expected-error {{reference to property 'x' in closure requires explicit 'self.' to make capture semantics explicit}} {{15-15=self.}}
141
+
doVoidStuff({x +=1}) // expected-error {{reference to property 'x' in closure requires explicit 'self.' to make capture semantics explicit}} {{19-19=self.}}
142
142
143
143
// Methods follow the same rules as properties, uses of 'self' must be marked with "self."
144
144
doStuff{method()} // expected-error {{call to method 'method' in closure requires explicit 'self.' to make capture semantics explicit}} {{15-15=self.}}
Copy file name to clipboardExpand all lines: test/stmt/statements.swift
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -121,22 +121,22 @@ SomeGeneric<Int>
121
121
func for_loop(){
122
122
varx=0
123
123
for ;; {} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
124
-
for x =1; x !=42; ++x{} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
124
+
for x =1; x !=42; x +=1{} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
125
125
forinfloopbooltest(); x != 12; infloopbooltest(){} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
126
126
127
127
for ; {} // expected-error {{expected ';' in 'for' statement}}
128
128
129
-
for var y =1; y !=42; ++y{} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
130
-
for (var y =1; y != 42; ++y){} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
129
+
for var y =1; y !=42; y +=1{} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
130
+
for (var y =1; y !=42; y +=1){} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
131
131
varz=10
132
-
for (; z !=0; --z){} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
133
-
for (z =10; z !=0;--z){} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
134
-
for var(a,b)=(0,12); a != b; --b {++a} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
135
-
for (var(a,b)=(0,12); a != b; --b){++a} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
132
+
for (; z !=0; z -=1){} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
133
+
for (z =10; z !=0;z -=1){} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
134
+
for var(a,b)=(0,12); a != b; b -=1{a +=1} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
135
+
for (var(a,b)=(0,12); a != b; b -=1){a +=1} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
136
136
varj,k:Int
137
-
for ((j,k)=(0,10); j != k; --k){} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
138
-
for var i =0, j =0; i * j <10; i++, j++{} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
139
-
for j =0, k =52; j < k; ++j,--k{} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
137
+
for ((j,k)=(0,10); j != k; k -=1){} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
138
+
for var i =0, j =0; i * j <10; i+=1, j+=1{} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
139
+
for j =0, k =52; j < k; j +=1, k -=1{} // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
140
140
// rdar://19540536
141
141
// expected-error@+4{{expected var declaration in a 'for' statement}}
142
142
// expected-error@+3{{expression resolves to an unused function}}
for i; // expected-error {{expression resolves to an unused l-value}} expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
430
-
i <10; ++i{}
430
+
i <10; i +=1{}
431
431
}
432
432
433
433
// rdar://problem/18643692
434
434
func for_loop_multi_iter(){
435
-
for (var i=0, x =0; i <10; i++, // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
435
+
for (var i=0, x =0; i <10; i+=1, // expected-warning {{C-style for statement is deprecated and will be removed in a future version of Swift}}
436
436
x){ // expected-error {{expression resolves to an unused l-value}}
0 commit comments