mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
23 lines
669 B
Swift
23 lines
669 B
Swift
// REQUIRES: concurrency
|
|
|
|
// RUN: %target-typecheck-verify-swift
|
|
|
|
if #available(SwiftStdlib 5.5, *) {
|
|
@available(*, renamed: "process(data:)")
|
|
func process(data: [Int], completion: @escaping ([Int]) -> Void) { completion(data) }
|
|
// expected-note@+1{{'process(data:)' declared here}}
|
|
func process(data: [Int]) async -> [Int] { return data }
|
|
|
|
func asyncFunc(data: [Int]) async {
|
|
defer {
|
|
process(data: data, completion: { print($0) })
|
|
}
|
|
|
|
func b() {
|
|
process(data: data, completion: { print($0) })
|
|
}
|
|
// expected-warning@+1{{consider using asynchronous alternative function}}
|
|
process(data: data, completion: { print($0) })
|
|
}
|
|
}
|