Skip to content

Commit 239f8d8

Browse files
committed
Rename AsyncIteratorProtocol._nextElement -> nextElement
1 parent b2a5ebe commit 239f8d8

File tree

7 files changed

+12
-13
lines changed

7 files changed

+12
-13
lines changed

include/swift/AST/KnownIdentifiers.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ IDENTIFIER(load)
123123
IDENTIFIER(main)
124124
IDENTIFIER_WITH_NAME(MainEntryPoint, "$main")
125125
IDENTIFIER(next)
126-
IDENTIFIER_(nextElement)
126+
IDENTIFIER(nextElement)
127127
IDENTIFIER_(nsErrorDomain)
128128
IDENTIFIER(objectAtIndexedSubscript)
129129
IDENTIFIER(objectForKeyedSubscript)

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,8 +957,7 @@ FuncDecl *ASTContext::getAsyncIteratorNext() const {
957957
if (!proto)
958958
return nullptr;
959959

960-
if (auto *func = lookupRequirement(
961-
proto, getIdentifier("_nextElement"))) {
960+
if (auto *func = lookupRequirement(proto, Id_nextElement)) {
962961
getImpl().AsyncIteratorNext = func;
963962
return func;
964963
}

lib/Sema/TypeCheckEffects.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ class ApplyClassifier {
13351335
isRethrowLikeTypedThrows(fnRef.getFunction())) {
13361336
// If we are in a rethrowing context and the function we're referring
13371337
// to is a rethrow-like function using typed throws or we are
1338-
// calling the next() or _nextElement() of an async iterator,
1338+
// calling the next() or nextElement() of an async iterator,
13391339
// then look at all of the closure arguments.
13401340
LLVM_FALLTHROUGH;
13411341
} else {
@@ -3503,7 +3503,7 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
35033503
CurContext.diagnoseUnhandledThrowStmt(Ctx.Diags, S);
35043504

35053505
// Note: we don't need to check the thrown error type specifically,
3506-
// because we will also be checking the _nextElement call.
3506+
// because we will also be checking the nextElement call.
35073507
}
35083508

35093509
return ShouldRecurse;

stdlib/public/Concurrency/AsyncIteratorProtocol.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ public protocol AsyncIteratorProtocol<Element, Failure> {
105105
/// - Returns: The next element, if it exists, or `nil` to signal the end of
106106
/// the sequence.
107107
@available(SwiftStdlib 5.11, *)
108-
mutating func _nextElement() async throws(Failure) -> Element?
108+
mutating func nextElement() async throws(Failure) -> Element?
109109
}
110110

111111
@available(SwiftStdlib 5.1, *)
112112
extension AsyncIteratorProtocol {
113-
/// Default implementation of `_nextElement()` in terms of `next()`, which is
113+
/// Default implementation of `nextElement()` in terms of `next()`, which is
114114
/// required to maintain backward compatibility with existing async iterators.
115115
@_alwaysEmitIntoClient
116-
public mutating func _nextElement() async throws(Failure) -> Element? {
116+
public mutating func nextElement() async throws(Failure) -> Element? {
117117
do {
118118
return try await next()
119119
} catch {

test/IRGen/async/weak_availability.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ public func f<S: AsyncSequence>(_ s: S) async throws -> Any.Type {
99
return Fn.self
1010
}
1111

12-
// MAYBE-AVAILABLE: @"$sScI12_nextElement0B0QzSgyYa7FailureQzYKFTjTu" = extern_weak global
12+
// MAYBE-AVAILABLE: @"$sScI11nextElement0B0QzSgyYa7FailureQzYKFTjTu" = extern_weak global
1313
// MAYBE-AVAILABLE: declare{{.*}} extern_weak{{.*}} @swift_getFunctionTypeMetadataGlobalActor

test/SILGen/foreach_async.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct AsyncLazySequence<S: Sequence>: AsyncSequence {
8181
// CHECK: [[LOOP_DEST]]:
8282
// CHECK: [[NEXT_RESULT:%.*]] = alloc_stack $Optional<Int>
8383
// CHECK: [[MUTATION:%.*]] = begin_access
84-
// CHECK: [[WITNESS_METHOD:%.*]] = function_ref @$sScIsE12_nextElement0B0QzSgyYa7FailureQzYKF : $@convention(method) @async <τ_0_0 where τ_0_0 : AsyncIteratorProtocol> (@inout τ_0_0) -> (@out Optional<τ_0_0.Element>, @error_indirect τ_0_0.Failure)
84+
// CHECK: [[WITNESS_METHOD:%.*]] = function_ref @$sScIsE11nextElement0B0QzSgyYa7FailureQzYKF : $@convention(method) @async <τ_0_0 where τ_0_0 : AsyncIteratorProtocol> (@inout τ_0_0) -> (@out Optional<τ_0_0.Element>, @error_indirect τ_0_0.Failure)
8585
// CHECK: [[ERROR_SLOT:%[0-9]+]] = alloc_stack $Never
8686
// CHECK: try_apply [[WITNESS_METHOD]]<AsyncLazySequence<[Int]>.Iterator>([[NEXT_RESULT]], [[ERROR_SLOT]], [[MUTATION]]) : $@convention(method) @async <τ_0_0 where τ_0_0 : AsyncIteratorProtocol> (@inout τ_0_0) -> (@out Optional<τ_0_0.Element>, @error_indirect τ_0_0.Failure), normal [[NORMAL_BB:bb[0-2]+]], error [[ERROR_BB:bb[0-9]+]]
8787
// CHECK: [[NORMAL_BB]](
@@ -113,7 +113,7 @@ func trivialStruct(_ xx: AsyncLazySequence<[Int]>) async {
113113
// CHECK: [[LOOP_DEST]]:
114114
// CHECK: [[NEXT_RESULT:%.*]] = alloc_stack $Optional<Int>
115115
// CHECK: [[MUTATION:%.*]] = begin_access
116-
// CHECK: [[WITNESS_METHOD:%.*]] = function_ref @$sScIsE12_nextElement0B0QzSgyYa7FailureQzYKF : $@convention(method) @async <τ_0_0 where τ_0_0 : AsyncIteratorProtocol> (@inout τ_0_0) -> (@out Optional<τ_0_0.Element>, @error_indirect τ_0_0.Failure)
116+
// CHECK: [[WITNESS_METHOD:%.*]] = function_ref @$sScIsE11nextElement0B0QzSgyYa7FailureQzYKF : $@convention(method) @async <τ_0_0 where τ_0_0 : AsyncIteratorProtocol> (@inout τ_0_0) -> (@out Optional<τ_0_0.Element>, @error_indirect τ_0_0.Failure)
117117
// CHECK: [[ERROR_SLOT:%[0-9]+]] = alloc_stack $Never
118118
// CHECK: try_apply [[WITNESS_METHOD]]<AsyncLazySequence<[Int]>.Iterator>([[NEXT_RESULT]], [[ERROR_SLOT]], [[MUTATION]]) : $@convention(method) @async <τ_0_0 where τ_0_0 : AsyncIteratorProtocol> (@inout τ_0_0) -> (@out Optional<τ_0_0.Element>, @error_indirect τ_0_0.Failure), normal [[NORMAL_BB:bb[0-2]+]], error [[ERROR_BB:bb[0-9]+]]
119119
// CHECK: [[NORMAL_BB]](
@@ -172,7 +172,7 @@ func trivialStructBreak(_ xx: AsyncLazySequence<[Int]>) async {
172172
// CHECK: [[LOOP_DEST]]:
173173
// CHECK: [[NEXT_RESULT:%.*]] = alloc_stack $Optional<Int>
174174
// CHECK: [[MUTATION:%.*]] = begin_access
175-
// CHECK: [[WITNESS_METHOD:%.*]] = function_ref @$sScIsE12_nextElement0B0QzSgyYa7FailureQzYKF : $@convention(method) @async <τ_0_0 where τ_0_0 : AsyncIteratorProtocol> (@inout τ_0_0) -> (@out Optional<τ_0_0.Element>, @error_indirect τ_0_0.Failure)
175+
// CHECK: [[WITNESS_METHOD:%.*]] = function_ref @$sScIsE11nextElement0B0QzSgyYa7FailureQzYKF : $@convention(method) @async <τ_0_0 where τ_0_0 : AsyncIteratorProtocol> (@inout τ_0_0) -> (@out Optional<τ_0_0.Element>, @error_indirect τ_0_0.Failure)
176176
// CHECK: [[ERROR_SLOT:%[0-9]+]] = alloc_stack $Never
177177
// CHECK: try_apply [[WITNESS_METHOD]]<AsyncLazySequence<[Int]>.Iterator>([[NEXT_RESULT]], [[ERROR_SLOT]], [[MUTATION]]) : $@convention(method) @async <τ_0_0 where τ_0_0 : AsyncIteratorProtocol> (@inout τ_0_0) -> (@out Optional<τ_0_0.Element>, @error_indirect τ_0_0.Failure), normal [[NORMAL_BB:bb[0-2]+]], error [[ERROR_BB:bb[0-9]+]]
178178
// CHECK: [[NORMAL_BB]](

test/api-digester/stability-concurrency-abi.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Protocol AsyncSequence has generic signature change from <Self.AsyncIterator : _
6565
Struct CheckedContinuation has removed conformance to UnsafeSendable
6666
Protocol AsyncIteratorProtocol is now without @rethrows
6767
Protocol AsyncSequence is now without @rethrows
68-
Func AsyncIteratorProtocol._nextElement() has been added as a protocol requirement
68+
Func AsyncIteratorProtocol.nextElement() has been added as a protocol requirement
6969

7070
// SerialExecutor gained `enqueue(_: __owned Job)`, protocol requirements got default implementations
7171
Func SerialExecutor.enqueue(_:) has been added as a protocol requirement

0 commit comments

Comments
 (0)