Skip to content

Commit c0adf40

Browse files
committed
stdlib: Move Generator and _Element typealiases to Sequence and Collection protocols
The requirement machine does not allow 'where' clauses to reference typealiases defined in protocol extensions. These should probably be removed entirely since they're not useful anymore, but I'd rather that decision was made by the stdlib folks.
1 parent a69ac78 commit c0adf40

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

stdlib/public/core/Collection.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ public protocol Collection: Sequence {
344344
// FIXME: Associated type inference requires this.
345345
override associatedtype Element
346346

347+
// FIXME: <rdar://problem/34142121>
348+
// This typealias should be removed as it predates the source compatibility
349+
// guarantees of Swift 3, but it cannot due to a bug.
350+
@available(swift, deprecated: 3.2, obsoleted: 5.0, renamed: "Element")
351+
typealias _Element = Element
352+
347353
/// A type that represents a position in the collection.
348354
///
349355
/// Valid indices consist of the position of every element and a

stdlib/public/core/MigrationSupport.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,6 @@ extension Substring: _CustomPlaygroundQuickLookable {
319319
#endif
320320

321321
extension Collection {
322-
// FIXME: <rdar://problem/34142121>
323-
// This typealias should be removed as it predates the source compatibility
324-
// guarantees of Swift 3, but it cannot due to a bug.
325-
@available(*, unavailable, renamed: "Iterator")
326-
public typealias Generator = Iterator
327-
328-
@available(swift, deprecated: 3.2, obsoleted: 5.0, renamed: "Element")
329-
public typealias _Element = Element
330-
331322
@available(swift, deprecated: 4.0, obsoleted: 5.0, message: "all index distances are now of type Int")
332323
public func index<T: BinaryInteger>(_ i: Index, offsetBy n: T) -> Index {
333324
return index(i, offsetBy: Int(n))

stdlib/public/core/Sequence.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,12 @@ public protocol Sequence {
330330
/// encapsulates its iteration state.
331331
associatedtype Iterator: IteratorProtocol where Iterator.Element == Element
332332

333+
// FIXME: <rdar://problem/34142121>
334+
// This typealias should be removed as it predates the source compatibility
335+
// guarantees of Swift 3, but it cannot due to a bug.
336+
@available(*, unavailable, renamed: "Iterator")
337+
typealias Generator = Iterator
338+
333339
/// A type that represents a subsequence of some of the sequence's elements.
334340
// associatedtype SubSequence: Sequence = AnySequence<Element>
335341
// where Element == SubSequence.Element,

0 commit comments

Comments
 (0)