File tree Expand file tree Collapse file tree 3 files changed +50
-4
lines changed Expand file tree Collapse file tree 3 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 77- (void )butt : (NSInteger )x completionHandler : (void (^ _Nonnull)(NSInteger ))handler ;
88
99@end
10+
11+ @interface Farm : NSObject
12+
13+ -(void )getDogWithCompletion : (void (^ _Nonnull)(NSInteger ))completionHandler
14+ __attribute__((swift_async_name(" getter:doggo()" )));
15+
16+ -(void )obtainCat : (void (^ _Nonnull)(NSInteger , NSError * _Nullable))completionHandler
17+ __attribute__((swift_async_name(" getter:catto()" )));
18+
19+ @end
Original file line number Diff line number Diff line change @@ -13,3 +13,17 @@ - (void)butt:(NSInteger)x completionHandler:(void (^)(NSInteger))handler {
1313}
1414
1515@end
16+
17+ @implementation Farm
18+
19+ -(void )getDogWithCompletion : (void (^ _Nonnull)(NSInteger ))completionHandler {
20+ printf (" getting dog\n " );
21+ completionHandler (123 );
22+ }
23+
24+ -(void )obtainCat : (void (^ _Nonnull)(NSInteger , NSError * _Nullable))completionHandler {
25+ printf (" obtaining cat has failed!\n " );
26+ completionHandler (nil , [NSError errorWithDomain: @" obtainCat" code: 456 userInfo: nil ]);
27+ }
28+
29+ @end
Original file line number Diff line number Diff line change 1010// rdar://76038845
1111// UNSUPPORTED: use_os_stdlib
1212
13- @main struct Main {
14- static func main( ) async {
13+ func buttTest( ) async {
1514 let butt = Butt ( )
1615 let result = await butt. butt ( 1738 )
1716 print ( " finishing \( result) " )
17+ }
18+
19+ func farmTest( ) async {
20+ let farm = Farm ( )
21+ let dogNumber = await farm. doggo
22+ print ( " dog number = \( dogNumber) " )
23+ do {
24+ let _ = try await farm. catto
25+ } catch {
26+ print ( " caught exception " )
1827 }
1928}
2029
21- // CHECK: starting 1738
22- // CHECK-NEXT: finishing 679
30+ @main struct Main {
31+ static func main( ) async {
32+ // CHECK: starting 1738
33+ // CHECK-NEXT: finishing 679
34+ await buttTest ( )
35+
36+ // CHECK-NEXT: getting dog
37+ // CHECK-NEXT: dog number = 123
38+ // CHECK-NEXT: obtaining cat has failed!
39+ // CHECK-NEXT: caught exception
40+ await farmTest ( )
41+ }
42+ }
43+
44+
You can’t perform that action at this time.
0 commit comments