Skip to content

Commit c306843

Browse files
committed
[PrintAsObjC] Make async completions _Nonnull
When we printed `async` methods, we did not print a nullability annotation on the `completionHandler` parameter. This commit adds `_Nonnull`, which matches the generated SIL. Fixes rdar://80989714.
1 parent 04775d4 commit c306843

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/PrintAsObjC/DeclAndTypePrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ class DeclAndTypePrinter::Implementation
591591
if (asyncConvention &&
592592
i == asyncConvention->completionHandlerParamIndex()) {
593593
os << piece << ":(";
594-
print(asyncConvention->completionHandlerType(), None);
594+
print(asyncConvention->completionHandlerType(), OTK_None);
595595
os << ")completionHandler";
596596
continue;
597597
}

test/PrintAsObjC/async.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ import Foundation
1919

2020
// CHECK-LABEL: @interface BarClass : NSObject
2121
@objc @objcMembers class BarClass: NSObject {
22-
// CHECK: (void)doSomethingBigWithCompletionHandler:(void (^)(NSInteger))completionHandler;
22+
// CHECK: (void)doSomethingBigWithCompletionHandler:(void (^ _Nonnull)(NSInteger))completionHandler;
2323
func doSomethingBig() async -> Int { 0 }
2424

25-
// CHECK: - (void)longRunningWithString:(NSString * _Nonnull)string completionHandler:(void (^)(BarClass * _Nullable, NSError * _Nullable))completionHandler;
25+
// CHECK: - (void)longRunningWithString:(NSString * _Nonnull)string completionHandler:(void (^ _Nonnull)(BarClass * _Nullable, NSError * _Nullable))completionHandler;
2626
func longRunning(string: String) async throws -> BarClass { return self }
2727

28-
// CHECK: - (void)magicTupleReturnWithCompletionHandler:(void (^)(BarClass * _Nonnull, NSInteger))completionHandler;
28+
// CHECK: - (void)magicTupleReturnWithCompletionHandler:(void (^ _Nonnull)(BarClass * _Nonnull, NSInteger))completionHandler;
2929
func magicTupleReturn() async -> (BarClass, Int) { return (self, 0) }
3030
}
3131
// CHECK: @end

0 commit comments

Comments
 (0)