mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Due to a missing source location in the implicitly-generated `await` in the async for loop, we misdiagnosed availability within an `if #available`. Fixes rdar://128560745.
19 lines
391 B
Swift
19 lines
391 B
Swift
// RUN: %target-swift-frontend -target %target-cpu-apple-macos14.0 %s -emit-sil -o /dev/null -verify
|
|
|
|
// REQUIRES: concurrency, OS=macosx
|
|
|
|
func acceptClosure(_: () async throws -> Void) { }
|
|
|
|
@available(macOS 13.0, *)
|
|
func f<S: AsyncSequence>(s: S) async throws {
|
|
acceptClosure {
|
|
if #available(SwiftStdlib 6.0, *) {
|
|
for try await x in s {
|
|
print(x)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|