Skip to content

Commit 7ed32b8

Browse files
committed
[Concurrency] Add a test for async ranking over optional promotion.
1 parent f467c0a commit 7ed32b8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/Constraints/async.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ func overloadedSame() async -> String { "asynchronous" }
1717
func overloaded() -> String { "synchronous" }
1818
func overloaded() async -> Double { 3.14159 }
1919

20+
@available(swift, deprecated: 4.0, message: "synchronous is no fun")
21+
func overloadedOptDifference() -> String { "synchronous" }
22+
23+
func overloadedOptDifference() async -> String? { nil }
24+
2025
func testOverloadedSync() {
2126
_ = overloadedSame() // expected-warning{{synchronous is no fun}}
2227

28+
let _: String? = overloadedOptDifference() // expected-warning{{synchronous is no fun}}
29+
2330
let _ = overloaded()
2431
let fn = {
2532
overloaded()
@@ -47,6 +54,8 @@ func testOverloadedSync() {
4754
func testOverloadedAsync() async {
4855
_ = await overloadedSame() // no warning
4956

57+
let _: String? = await overloadedOptDifference() // no warning
58+
5059
let _ = await overloaded()
5160
let _ = overloaded() // expected-error{{call is 'async' but is not marked with 'await'}}
5261

0 commit comments

Comments
 (0)