Skip to content

Commit 4f6b4cf

Browse files
committed
---
yaml --- r: 344927 b: refs/heads/master c: a2a6724 h: refs/heads/master i: 344925: cb2c056 344923: 7c79ad6 344919: 260357e 344911: 531980c 344895: e39192a
1 parent 81ae5fa commit 4f6b4cf

File tree

6 files changed

+17
-174
lines changed

6 files changed

+17
-174
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: 45b7df445e06dc9f13328400cc2ae0ac7b3bbf73
2+
refs/heads/master: a2a6724183194b8cbc13da115be6cf553d5d5bda
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/BidirectionalCollection.swift

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@
3737
/// `c.index(after: c.index(before: i)) == i`.
3838
public protocol BidirectionalCollection: Collection
3939
where SubSequence: BidirectionalCollection, Indices: BidirectionalCollection {
40-
// FIXME(ABI): Associated type inference requires this.
41-
associatedtype Element
42-
43-
// FIXME(ABI): Associated type inference requires this.
44-
associatedtype Index
45-
46-
// FIXME(ABI): Associated type inference requires this.
47-
associatedtype SubSequence
48-
4940
// FIXME(ABI): Associated type inference requires this.
5041
associatedtype Indices
5142

@@ -62,23 +53,6 @@ where SubSequence: BidirectionalCollection, Indices: BidirectionalCollection {
6253
/// `startIndex`.
6354
func formIndex(before i: inout Index)
6455

65-
/// Returns the position immediately after the given index.
66-
///
67-
/// The successor of an index must be well defined. For an index `i` into a
68-
/// collection `c`, calling `c.index(after: i)` returns the same index every
69-
/// time.
70-
///
71-
/// - Parameter i: A valid index of the collection. `i` must be less than
72-
/// `endIndex`.
73-
/// - Returns: The index value immediately after `i`.
74-
func index(after i: Index) -> Index
75-
76-
/// Replaces the given index with its successor.
77-
///
78-
/// - Parameter i: A valid index of the collection. `i` must be less than
79-
/// `endIndex`.
80-
func formIndex(after i: inout Index)
81-
8256
/// Returns an index that is the specified distance from the given index.
8357
///
8458
/// The following example obtains an index advanced four positions from a
@@ -172,25 +146,6 @@ where SubSequence: BidirectionalCollection, Indices: BidirectionalCollection {
172146
/// resulting distance.
173147
func distance(from start: Index, to end: Index) -> Int
174148

175-
/// The indices that are valid for subscripting the collection, in ascending
176-
/// order.
177-
///
178-
/// A collection's `indices` property can hold a strong reference to the
179-
/// collection itself, causing the collection to be non-uniquely referenced.
180-
/// If you mutate the collection while iterating over its indices, a strong
181-
/// reference can cause an unexpected copy of the collection. To avoid the
182-
/// unexpected copy, use the `index(after:)` method starting with
183-
/// `startIndex` to produce indices instead.
184-
///
185-
/// var c = MyFancyCollection([10, 20, 30, 40, 50])
186-
/// var i = c.startIndex
187-
/// while i != c.endIndex {
188-
/// c[i] /= 5
189-
/// i = c.index(after: i)
190-
/// }
191-
/// // c == MyFancyCollection([2, 4, 6, 8, 10])
192-
var indices: Indices { get }
193-
194149
// TODO: swift-3-indexing-model: tests.
195150
/// The last element of the collection.
196151
///
@@ -204,40 +159,6 @@ where SubSequence: BidirectionalCollection, Indices: BidirectionalCollection {
204159
///
205160
/// - Complexity: O(1)
206161
var last: Element? { get }
207-
208-
/// Accesses a contiguous subrange of the collection's elements.
209-
///
210-
/// The accessed slice uses the same indices for the same elements as the
211-
/// original collection uses. Always use the slice's `startIndex` property
212-
/// instead of assuming that its indices start at a particular value.
213-
///
214-
/// This example demonstrates getting a slice of an array of strings, finding
215-
/// the index of one of the strings in the slice, and then using that index
216-
/// in the original array.
217-
///
218-
/// let streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"]
219-
/// let streetsSlice = streets[2 ..< streets.endIndex]
220-
/// print(streetsSlice)
221-
/// // Prints "["Channing", "Douglas", "Evarts"]"
222-
///
223-
/// let index = streetsSlice.firstIndex(of: "Evarts") // 4
224-
/// print(streets[index!])
225-
/// // Prints "Evarts"
226-
///
227-
/// - Parameter bounds: A range of the collection's indices. The bounds of
228-
/// the range must be valid indices of the collection.
229-
///
230-
/// - Complexity: O(1)
231-
subscript(bounds: Range<Index>) -> SubSequence { get }
232-
233-
// FIXME(ABI): Associated type inference requires this.
234-
subscript(position: Index) -> Element { get }
235-
236-
// FIXME(ABI): Associated type inference requires this.
237-
var startIndex: Index { get }
238-
239-
// FIXME(ABI): Associated type inference requires this.
240-
var endIndex: Index { get }
241162
}
242163

243164
/// Default implementation for bidirectional collections.

trunk/stdlib/public/core/MutableCollection.swift

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,7 @@
5858
/// a[i] = x
5959
/// let y = x
6060
public protocol MutableCollection: Collection
61-
where SubSequence: MutableCollection
62-
{
63-
// FIXME(ABI): Associated type inference requires this.
64-
associatedtype Element
65-
66-
// FIXME(ABI): Associated type inference requires this.
67-
associatedtype Index
68-
69-
// FIXME(ABI): Associated type inference requires this.
70-
associatedtype SubSequence
71-
61+
where SubSequence: MutableCollection {
7262
/// Accesses the element at the specified position.
7363
///
7464
/// For example, you can replace an element of an array by using its

trunk/stdlib/public/core/RandomAccessCollection.swift

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,7 @@
3131
/// `Strideable` protocol or you must implement the `index(_:offsetBy:)` and
3232
/// `distance(from:to:)` methods with O(1) efficiency.
3333
public protocol RandomAccessCollection: BidirectionalCollection
34-
where SubSequence: RandomAccessCollection, Indices: RandomAccessCollection
35-
{
36-
// FIXME(ABI): Associated type inference requires this.
37-
associatedtype Element
38-
39-
// FIXME(ABI): Associated type inference requires this.
40-
associatedtype Index
41-
42-
// FIXME(ABI): Associated type inference requires this.
43-
associatedtype SubSequence
44-
45-
// FIXME(ABI): Associated type inference requires this.
46-
associatedtype Indices
47-
48-
/// The indices that are valid for subscripting the collection, in ascending
49-
/// order.
50-
///
51-
/// A collection's `indices` property can hold a strong reference to the
52-
/// collection itself, causing the collection to be nonuniquely referenced.
53-
/// If you mutate the collection while iterating over its indices, a strong
54-
/// reference can result in an unexpected copy of the collection. To avoid
55-
/// the unexpected copy, use the `index(after:)` method starting with
56-
/// `startIndex` to produce indices instead.
57-
///
58-
/// var c = MyFancyCollection([10, 20, 30, 40, 50])
59-
/// var i = c.startIndex
60-
/// while i != c.endIndex {
61-
/// c[i] /= 5
62-
/// i = c.index(after: i)
63-
/// }
64-
/// // c == MyFancyCollection([2, 4, 6, 8, 10])
65-
var indices: Indices { get }
66-
34+
where SubSequence: RandomAccessCollection, Indices: RandomAccessCollection {
6735
/// Accesses a contiguous subrange of the collection's elements.
6836
///
6937
/// The accessed slice uses the same indices for the same elements as the
@@ -89,45 +57,6 @@ where SubSequence: RandomAccessCollection, Indices: RandomAccessCollection
8957
/// - Complexity: O(1)
9058
subscript(bounds: Range<Index>) -> SubSequence { get }
9159

92-
// FIXME(ABI): Associated type inference requires this.
93-
subscript(position: Index) -> Element { get }
94-
95-
// FIXME(ABI): Associated type inference requires this.
96-
var startIndex: Index { get }
97-
98-
// FIXME(ABI): Associated type inference requires this.
99-
var endIndex: Index { get }
100-
101-
/// Returns the position immediately before the given index.
102-
///
103-
/// - Parameter i: A valid index of the collection. `i` must be greater than
104-
/// `startIndex`.
105-
/// - Returns: The index value immediately before `i`.
106-
func index(before i: Index) -> Index
107-
108-
/// Replaces the given index with its predecessor.
109-
///
110-
/// - Parameter i: A valid index of the collection. `i` must be greater than
111-
/// `startIndex`.
112-
func formIndex(before i: inout Index)
113-
114-
/// Returns the position immediately after the given index.
115-
///
116-
/// The successor of an index must be well defined. For an index `i` into a
117-
/// collection `c`, calling `c.index(after: i)` returns the same index every
118-
/// time.
119-
///
120-
/// - Parameter i: A valid index of the collection. `i` must be less than
121-
/// `endIndex`.
122-
/// - Returns: The index value immediately after `i`.
123-
func index(after i: Index) -> Index
124-
125-
/// Replaces the given index with its successor.
126-
///
127-
/// - Parameter i: A valid index of the collection. `i` must be less than
128-
/// `endIndex`.
129-
func formIndex(after i: inout Index)
130-
13160
/// Returns an index that is the specified distance from the given index.
13261
///
13362
/// The following example obtains an index advanced four positions from a

trunk/stdlib/public/core/RangeReplaceableCollection.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@
6262
/// parameter. You can override any of the protocol's required methods to
6363
/// provide your own custom implementation.
6464
public protocol RangeReplaceableCollection : Collection
65-
where SubSequence : RangeReplaceableCollection {
66-
// FIXME(ABI): Associated type inference requires this.
67-
associatedtype SubSequence
65+
where SubSequence : RangeReplaceableCollection {
6866

6967
//===--- Fundamental Requirements ---------------------------------------===//
7068

@@ -147,8 +145,7 @@ public protocol RangeReplaceableCollection : Collection
147145
///
148146
/// - Parameter elements: The sequence of elements for the new collection.
149147
/// `elements` must be finite.
150-
init<S : Sequence>(_ elements: S)
151-
where S.Element == Element
148+
init<S : Sequence>(_ elements: S) where S.Element == Element
152149

153150
/// Adds an element to the end of the collection.
154151
///
@@ -361,12 +358,6 @@ public protocol RangeReplaceableCollection : Collection
361358
/// - Complexity: O(*n*), where *n* is the length of the collection.
362359
mutating func removeAll(
363360
where shouldBeRemoved: (Element) throws -> Bool) rethrows
364-
365-
// FIXME(ABI): Associated type inference requires this.
366-
subscript(bounds: Index) -> Element { get }
367-
368-
// FIXME(ABI): Associated type inference requires this.
369-
subscript(bounds: Range<Index>) -> SubSequence { get }
370361
}
371362

372363
//===----------------------------------------------------------------------===//

trunk/test/api-digester/source-stability.swift.expected

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ TypeAlias StringProtocol.UTF16Index has been removed (deprecated)
1414
TypeAlias StringProtocol.UTF8Index has been removed (deprecated)
1515
TypeAlias StringProtocol.UnicodeScalarIndex has been removed (deprecated)
1616
TypeAlias UIntMax has been removed
17+
Var BidirectionalCollection.endIndex has been removed
18+
Var BidirectionalCollection.indices has been removed
19+
Var BidirectionalCollection.startIndex has been removed
1720
Var FixedWidthInteger.allZeros has been removed (deprecated)
21+
Var RandomAccessCollection.endIndex has been removed
22+
Var RandomAccessCollection.indices has been removed
23+
Var RandomAccessCollection.startIndex has been removed
1824
Constructor Int.init(truncatingBitPattern:) has been removed
1925
Constructor Int16.init(truncatingBitPattern:) has been removed
2026
Constructor Int32.init(truncatingBitPattern:) has been removed
@@ -24,6 +30,8 @@ Constructor UInt.init(truncatingBitPattern:) has been removed
2430
Constructor UInt16.init(truncatingBitPattern:) has been removed
2531
Constructor UInt32.init(truncatingBitPattern:) has been removed
2632
Constructor UInt8.init(truncatingBitPattern:) has been removed
33+
Func BidirectionalCollection.formIndex(after:) has been removed
34+
Func BidirectionalCollection.index(after:) has been removed
2735
Func BinaryInteger.toIntMax() has been removed
2836
Func FixedWidthInteger.addWithOverflow(_:_:) has been removed
2937
Func FixedWidthInteger.divideWithOverflow(_:_:) has been removed
@@ -45,6 +53,10 @@ Func Int16.toUIntMax() has been removed
4553
Func Int32.toUIntMax() has been removed
4654
Func Int64.toUIntMax() has been removed
4755
Func Int8.toUIntMax() has been removed
56+
Func RandomAccessCollection.formIndex(after:) has been removed
57+
Func RandomAccessCollection.formIndex(before:) has been removed
58+
Func RandomAccessCollection.index(after:) has been removed
59+
Func RandomAccessCollection.index(before:) has been removed
4860
Func Sequence.flatMap(_:) has been removed
4961
Func SignedNumeric.abs(_:) has been removed
5062
Func String.UTF16View.distance(from:to:) has been removed

0 commit comments

Comments
 (0)