mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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.
10 lines
276 B
Swift
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 { }
|
|
}
|