Skip to content

Commit 459430e

Browse files
committed
---
yaml --- r: 345082 b: refs/heads/master c: a1a71ac h: refs/heads/master
1 parent 57b5d7a commit 459430e

File tree

4 files changed

+26
-20
lines changed

4 files changed

+26
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 486888055e6083d0d3678282aeb360c657362004
2+
refs/heads/master: a1a71acd8cc7d859975dbc27592564d0cbfa4f4b
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/stdlib/public/core/CollectionAlgorithms.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ extension Collection where Element : Equatable {
7272
}
7373
return nil
7474
}
75-
76-
/// Returns the first index where the specified value appears in the
77-
/// collection.
78-
@inlinable
79-
public func index(of _element: Element) -> Index? {
80-
return firstIndex(of: _element)
81-
}
8275
}
8376

8477
extension Collection {
@@ -117,15 +110,6 @@ extension Collection {
117110
}
118111
return nil
119112
}
120-
121-
/// Returns the first index in which an element of the collection satisfies
122-
/// the given predicate.
123-
@inlinable
124-
public func index(
125-
where _predicate: (Element) throws -> Bool
126-
) rethrows -> Index? {
127-
return try firstIndex(where: _predicate)
128-
}
129113
}
130114

131115
//===----------------------------------------------------------------------===//

trunk/stdlib/public/core/MigrationSupport.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,28 @@ extension Collection {
10111011
}
10121012
}
10131013

1014+
extension Collection {
1015+
/// Returns the first index in which an element of the collection satisfies
1016+
/// the given predicate.
1017+
@available(swift, deprecated: 5.0, renamed: "firstIndex(where:)")
1018+
@inlinable
1019+
public func index(
1020+
where _predicate: (Element) throws -> Bool
1021+
) rethrows -> Index? {
1022+
return try firstIndex(where: _predicate)
1023+
}
1024+
}
1025+
1026+
extension Collection where Element: Equatable {
1027+
/// Returns the first index where the specified value appears in the
1028+
/// collection.
1029+
@available(swift, deprecated: 5.0, renamed: "firstIndex(of:)")
1030+
@inlinable
1031+
public func index(of element: Element) -> Index? {
1032+
return firstIndex(of: element)
1033+
}
1034+
}
1035+
10141036
extension String.Index {
10151037
@available(swift, deprecated: 3.2, obsoleted: 4.0)
10161038
public init(_position: Int) {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %target-typecheck-verify-swift
1+
// RUN: %target-typecheck-verify-swift -swift-version 5
22

33
let a = [10, 20, 30, 40, 50, 60]
44

5-
_ = a.index(of: 30)
5+
_ = a.index(of: 30) // expected-warning {{'index(of:)' is deprecated: renamed to 'firstIndex(of:)'}} expected-note {{use 'firstIndex(of:)' instead}}
66
_ = a.firstIndex(of: 30)
7-
_ = a.index(where: { $0 > 30 })
7+
_ = a.index(where: { $0 > 30 }) // expected-warning {{'index(where:)' is deprecated: renamed to 'firstIndex(where:)'}} expected-note {{use 'firstIndex(where:)' instead}}
88
_ = a.firstIndex(where: { $0 > 30 })

0 commit comments

Comments
 (0)