Skip to content

Commit 7ca06d5

Browse files
committed
[stdlib] Add missing anyGenerator migration aid
1 parent b37330d commit 7ca06d5

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

stdlib/public/core/ExistentialCollection.swift.gyb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,3 +1040,14 @@ extension AnyCollectionProtocol {
10401040
@available(*, unavailable, renamed: "AnyIndex")
10411041
public typealias Any${Traversal}Index = AnyIndex
10421042
% end
1043+
1044+
1045+
@available(*, unavailable, renamed: "AnyIterator.init(_:)")
1046+
public func anyGenerator<G : IteratorProtocol>(_ base: G) -> AnyIterator<G.Element> {
1047+
Builtin.unreachable()
1048+
}
1049+
1050+
@available(*, unavailable, renamed: "AnyIterator.init(_:)")
1051+
public func anyGenerator<Element>(_ body: () -> Element?) -> AnyIterator<Element> {
1052+
Builtin.unreachable()
1053+
}

test/1_stdlib/Renames.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ func _ExistentialCollection<T>(i: AnyIterator<T>) {
112112
func fn3(_: AnyForwardIndex) {} // expected-error {{'AnyForwardIndex' has been renamed to 'AnyIndex'}} {{15-30=AnyIndex}} {{none}}
113113
func fn4(_: AnyBidirectionalIndex) {} // expected-error {{'AnyBidirectionalIndex' has been renamed to 'AnyIndex'}} {{15-36=AnyIndex}} {{none}}
114114
func fn5(_: AnyRandomAccessIndex) {} // expected-error {{'AnyRandomAccessIndex' has been renamed to 'AnyIndex'}} {{15-35=AnyIndex}} {{none}}
115+
116+
_ = anyGenerator(i) // expected-error {{'anyGenerator' has been replaced by 'AnyIterator.init(_:)'}} {{7-19=AnyIterator}} {{none}}
117+
_ = anyGenerator { i.next() } // expected-error {{'anyGenerator' has been replaced by 'AnyIterator.init(_:)'}} {{7-19=AnyIterator}} {{none}}
115118
}
116119
func _ExistentialCollection<T>(s: AnySequence<T>) {
117120
_ = s.underestimateCount() // expected-error {{'underestimateCount()' is unavailable: Please use underestimatedCount property instead.}} {{none}}

0 commit comments

Comments
 (0)