@@ -9,10 +9,17 @@ func testNonConversions() async {
99}
1010
1111// Overloading
12+ @available ( swift, deprecated: 4.0 , message: " synchronous is no fun " )
13+ func overloadedSame( ) -> String { " synchronous " }
14+
15+ func overloadedSame( ) async -> String { " asynchronous " }
16+
1217func overloaded( ) -> String { " synchronous " }
1318func overloaded( ) async -> Double { 3.14159 }
1419
1520func testOverloadedSync( ) {
21+ _ = overloadedSame ( ) // expected-warning{{synchronous is no fun}}
22+
1623 let _ = overloaded ( )
1724 let fn = {
1825 overloaded ( )
@@ -38,6 +45,8 @@ func testOverloadedSync() {
3845}
3946
4047func testOverloadedAsync( ) async {
48+ _ = await overloadedSame ( ) // no warning
49+
4150 let _ = await overloaded ( )
4251 let _ = overloaded ( ) // expected-error{{call is 'async' but is not marked with 'await'}}
4352
@@ -63,3 +72,14 @@ func testOverloadedAsync() async {
6372 }
6473 let _: Int = fn4 // expected-error{{value of type '() async -> ()'}}
6574}
75+
76+ func takesAsyncClosure( _ closure: ( ) async -> String ) -> Int { 0 }
77+ func takesAsyncClosure( _ closure: ( ) -> String ) -> String { " " }
78+
79+ func testPassAsyncClosure( ) {
80+ let a = takesAsyncClosure { await overloadedSame ( ) }
81+ let _: Double = a // expected-error{{convert value of type 'Int'}}
82+
83+ let b = takesAsyncClosure { overloadedSame ( ) } // expected-warning{{synchronous is no fun}}
84+ let _: Double = b // expected-error{{convert value of type 'String'}}
85+ }
0 commit comments