Files
swift-mirror/test/Concurrency/async_sequence_macosx.swift
Doug Gregor 3564d14a84 Fix source location info to address availability error with next(isolation:)
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.
2024-05-24 22:29:42 -07:00

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)
}
}
}
}