Skip to content

Commit ae5f67c

Browse files
committed
stop using deprecated language/lib features in these testcases.
1 parent e80769d commit ae5f67c

File tree

3 files changed

+36
-35
lines changed

3 files changed

+36
-35
lines changed

Diff for: test/Prototypes/MutableIndexableDict.swift

+5-4
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct FixedSizedRefArrayOfOptional<T>
120120
init(capacity: Int)
121121
{
122122
buffer = Storage.Buffer(Storage.self, capacity, capacity)
123-
for var i = 0; i < capacity; ++i {
123+
for i in 0 ..< capacity {
124124
(buffer.baseAddress + i).initialize(with: .none)
125125
}
126126

@@ -182,7 +182,8 @@ struct DictionaryIndex<Element> : BidirectionalIndex {
182182

183183
func predecessor() -> Index {
184184
var j = self.offset
185-
while --j > 0 {
185+
while j > 1 {
186+
j -= 1
186187
if buffer[j] != nil {
187188
return Index(buffer: buffer, offset: j)
188189
}
@@ -275,7 +276,7 @@ struct Dictionary<Key: Hashable, Value> : Collection, Sequence {
275276
_buffer[i.offset] = Element(key: key, value: value)
276277

277278
if !found {
278-
++_count
279+
_count += 1
279280
}
280281
}
281282
}
@@ -360,7 +361,7 @@ struct Dictionary<Key: Hashable, Value> : Collection, Sequence {
360361

361362
// remove the element
362363
_buffer[pos.offset] = .none
363-
--_count
364+
_count -= 1
364365

365366
// If we've put a hole in a chain of contiguous elements, some
366367
// element after the hole may belong where the new hole is.

Diff for: test/SILGen/instrprof_basic.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func basic(a : Int32) {
3232
}
3333

3434
// CHECK: builtin "int_instrprof_increment"
35-
for var i: Int32 = 0; i < a; ++i {
35+
for i in 0 ..< a {
3636
}
3737

3838
// CHECK: builtin "int_instrprof_increment"

Diff for: test/SILGen/sil_locations.swift

+30-30
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
func ifexpr() -> Int {
66
var x : Int = 0
77
if true {
8-
x++;
8+
x+=1
99
}
1010
return x
1111
// CHECK-LABEL: sil hidden @_TF13sil_locations6ifexprFT_Si
@@ -18,9 +18,9 @@ func ifexpr() -> Int {
1818
func ifelseexpr() -> Int {
1919
var x : Int = 0
2020
if true {
21-
x++;
21+
x+=1
2222
} else {
23-
x--;
23+
x-=1
2424
}
2525
return x
2626
// CHECK-LABEL: sil hidden @_TF13sil_locations10ifelseexprFT_Si
@@ -62,15 +62,15 @@ func ifexpr_rval() -> Int {
6262
// CHECK: br bb{{[0-9]+}}({{%.*}}), loc "{{.*}}":[[@LINE-8]]:22
6363
}
6464

65-
// TODO: missing info on the first branch.
66-
func forstmt_empty_cond(_ i: Int) -> Int {
67-
for var i=0;;++i {}
68-
// CHECK-LABEL: sil hidden @{{.*}}forstmt_empty_cond{{.*}}
69-
// CHECK: apply {{.*}}, loc "{{.*}}":[[@LINE-2]]:13
70-
// CHECK: br [[TRUE_BB:bb[0-9]+]]
71-
// CHECK: [[TRUE_BB:bb[0-9]+]]:
72-
// CHECK: br [[TRUE_BB:bb[0-9]+]], loc "{{.*}}":[[@LINE-5]]:21
73-
}
65+
66+
67+
68+
69+
70+
71+
72+
73+
7474

7575
// --- Test function calls.
7676
func simpleDirectCallTest(_ i: Int) -> Int {
@@ -116,7 +116,7 @@ func multipleReturnsImplicitAndExplicit() {
116116
if x > 10 {
117117
return
118118
}
119-
x++;
119+
x += 1
120120
// CHECK-LABEL: sil hidden @_TF13sil_locations34multipleReturnsImplicitAndExplicitFT_T_
121121
// CHECK: cond_br
122122
// CHECK: br bb{{[0-9]+}}, loc "{{.*}}":[[@LINE-5]]:5, {{.*}}:return
@@ -175,13 +175,13 @@ func testIf() {
175175
}
176176

177177
func testFor() {
178-
for (var i:Int = 0; i<10; i++) {
178+
for i in 0..<10 {
179179
var y: Int = 300
180-
y++;
180+
y+=1
181181
if true {
182182
break
183183
}
184-
y--;
184+
y-=1
185185
continue
186186
}
187187

@@ -350,9 +350,9 @@ func testStringForEachStmt() {
350350

351351

352352
func testForStmt() {
353-
var i = 0
353+
354354
var m = 0
355-
for (i = 0; i < 10; ++i) {
355+
for i in 0..<10 {
356356
m += 1
357357
if m == 15 {
358358
break
@@ -363,19 +363,19 @@ func testForStmt() {
363363
}
364364

365365

366-
// CHECK-LABEL: sil hidden @_TF13sil_locations11testForStmtFT_T_
367-
// CHECK: br {{.*}} line:[[@LINE-12]]:3
368-
// CHECK: cond_br {{.*}} line:[[@LINE-13]]:15
369-
// CHECK: cond_br {{.*}} line:[[@LINE-12]]:8
370-
// Break branch:
371-
// CHECK: br {{.*}} line:[[@LINE-13]]:7
372-
// Continue branch:
373-
// CHECK: br {{.*}} line:[[@LINE-13]]:7
374-
// Looping back branch:
375-
// CHECK: br {{.*}} line:[[@LINE-12]]:3
376-
// Condition is false branch:
377-
// CHECK: br {{.*}} line:[[@LINE-22]]:3
378366

367+
368+
369+
370+
371+
372+
373+
374+
375+
376+
377+
378+
379379
}
380380

381381

0 commit comments

Comments
 (0)