Files
swift-mirror/test/Concurrency/async_for_each_back_deploy.swift
Doug Gregor 6ebb0ff560 Replace AsyncIteratorProtocol.nextElement() with isolated next(_:)
Use an optional isolated parameter to this new `next(_:)` overload to
keep it on the same actor as the caller, and pass `#isolation` when
desugaring the async for..in loop. This keeps async iteration loops on
the same actor, allowing non-Sendable values to be used with many
async sequences.
2024-01-25 16:04:48 -08:00

10 lines
276 B
Swift

// RUN: %target-swift-frontend -strict-concurrency=complete -dump-ast %s | %FileCheck %s
// REQUIRES: concurrency, OS=macosx
@available(SwiftStdlib 5.1, *)
func f<S: AsyncSequence>(s: S) async throws {
// CHECK-NOT: next(_:)
// CHECK: next()
for try await x in s { }
}