mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
All but 7 tests now passing. Those 7 tests either do not refer to these circumstances or do not seem to pass even when modified to accept type specifications.
33 lines
1.2 KiB
Swift
33 lines
1.2 KiB
Swift
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency -target %target-swift-5.1-abi-triple
|
|
|
|
// REQUIRES: concurrency
|
|
|
|
// We don't want 'reasync' overloads to have a higher score in the
|
|
// case of a sync vs reasync mismatch the way 'async' overloads do,
|
|
// since this would change solver performance characteristics when
|
|
// using the reasync '&&', '||' and '??' operators.
|
|
|
|
func asyncOverload(_: () async -> (), _: Int) async {}
|
|
func asyncOverload(_: () -> (), _: String) {}
|
|
|
|
func referencesAsyncOverload() {
|
|
_ = asyncOverload // we prefer the sync overload
|
|
}
|
|
|
|
func referencesAsyncOverloadAsync() async {
|
|
_ = asyncOverload // we prefer the async overload
|
|
}
|
|
|
|
func reasyncOverload(_: () async -> (), _: Int) reasync {} // expected-note {{found candidate with type '(() async -> (), Int) async -> ()'}}
|
|
func reasyncOverload(_: () -> (), _: String) {} // expected-note {{found candidate with type '(() -> (), String) -> ()'}}
|
|
|
|
func referencesReasyncOverload() {
|
|
_ = reasyncOverload // expected-error {{ambiguous use of 'reasyncOverload'}}
|
|
}
|
|
|
|
func referencesReasyncOverloadAsync() async {
|
|
// we prefer the async overload because the sync overload scores higher
|
|
// due to a sync-vs-async mismatch.
|
|
_ = reasyncOverload
|
|
}
|