Skip to content

Commit 9187839

Browse files
committed
Merge pull request #1607 from apple/swift-3-api-guidelines
Applying API guidelines to The Standard Library
2 parents 94e999f + 885b564 commit 9187839

File tree

1,378 files changed

+19862
-18504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,378 files changed

+19862
-18504
lines changed

benchmark/single-source/AngryPhonebook.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public func run_AngryPhonebook(N: Int) {
3636
for _ in 1...N {
3737
for firstname in words {
3838
for lastname in words {
39-
(firstname.uppercaseString, lastname.lowercaseString)
39+
(firstname.uppercased, lastname.lowercased)
4040
}
4141
}
4242
}

benchmark/single-source/ArrayInClass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ArrayContainer {
1414
final var arr : [Int]
1515

1616
init() {
17-
arr = [Int] (count: 100_000, repeatedValue: 0)
17+
arr = [Int] (repeating: 0, count: 100_000)
1818
}
1919

2020
func runLoop(N: Int) {

benchmark/single-source/ArrayOfGenericPOD.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class RefArray<T> {
2222
var array : [T]
2323

2424
init(_ i:T) {
25-
array = [T](count: 100000, repeatedValue: i)
25+
array = [T](repeating: i, count: 100000)
2626
}
2727
}
2828

benchmark/single-source/ArrayOfGenericRef.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class RefArray<T> {
5959
var array : [T]
6060

6161
init(_ i:T, count:Int = 10_000) {
62-
array = [T](count: count, repeatedValue: i)
62+
array = [T](repeating: i, count: count)
6363
}
6464
}
6565

benchmark/single-source/ArrayOfPOD.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class RefArray<T> {
2020
var array : [T]
2121

2222
init(_ i:T, count:Int = 100_000) {
23-
array = [T](count: count, repeatedValue: i)
23+
array = [T](repeating: i, count: count)
2424
}
2525
}
2626

benchmark/single-source/ArrayOfRef.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class RefArray<T> {
7171
var array : [T]
7272

7373
init(_ i:T, count:Int = 10_000) {
74-
array = [T](count: count, repeatedValue: i)
74+
array = [T](repeating: i, count: count)
7575
}
7676
}
7777

benchmark/single-source/ArraySubscript.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public func run_ArraySubscript(N: Int) {
2222

2323
func bound(x: Int) -> Int { return min(x, numArrayElements-1) }
2424

25-
var arrays = [[Int]](count: numArrays, repeatedValue: [])
25+
var arrays = [[Int]](repeating: [], count: numArrays)
2626
for i in 0..<numArrays {
2727
for _ in 0..<numArrayElements {
2828
arrays[i].append(Int(truncatingBitPattern: Random()))

benchmark/single-source/CaptureProp.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ func sum(x:Int, y:Int) -> Int {
1515
}
1616

1717
@inline(never)
18-
func benchCaptureProp<S : SequenceType
18+
func benchCaptureProp<S : Sequence
1919
>(
20-
s:S, _ f:(S.Generator.Element, S.Generator.Element)->S.Generator.Element) -> S.Generator.Element {
20+
s:S, _ f:(S.Iterator.Element, S.Iterator.Element)->S.Iterator.Element) -> S.Iterator.Element {
2121

22-
var g = s.generate()
23-
let initial = g.next()!
24-
return GeneratorSequence(g).reduce(initial, combine: f)
22+
var it = s.makeIterator()
23+
let initial = it.next()!
24+
return IteratorSequence(it).reduce(initial, combine: f)
2525
}
2626

2727
public func run_CaptureProp(N: Int) {

benchmark/single-source/DictionaryRemove.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public func run_DictionaryRemove(N: Int) {
3131
tmpDict = dict
3232
// Empty dictionary
3333
for i in 1...size {
34-
tmpDict.removeValueForKey(i)
34+
tmpDict.removeValue(forKey: i)
3535
}
3636
if !tmpDict.isEmpty {
3737
break

benchmark/single-source/ErrorHandling.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import TestsUtils
1414

15-
enum PizzaError : ErrorType {
15+
enum PizzaError : ErrorProtocol {
1616
case Pepperoni, Olives, Anchovy
1717
}
1818

0 commit comments

Comments
 (0)