-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
@objcFeature → attributes: The @objc attributeFeature → attributes: The @objc attributeSILGenArea → compiler: The SIL generation stageArea → compiler: The SIL generation stageasync & awaitFeature → concurrency: asynchronous function aka the async/await patternFeature → concurrency: asynchronous function aka the async/await patternattributesFeature: Declaration and type attributesFeature: Declaration and type attributesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featuresobjective-c interopFeature: Interoperability with Objective-CFeature: Interoperability with Objective-Cswift 5.7unexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output
Description
Description
SE-0297 says that
@objc func perform(operation: String) async -> Int { ... }
will be translated into
- (void)performWithOperation:(NSString * _Nonnull)operation
completionHandler:(void (^ _Nullable)(NSInteger))completionHandler;
However, when I tried it, the completion handler is _Nonnull
, resulting in the following warning when I try to pass nil
:
Null passed to a callee that requires a non-null argument
Steps to reproduce
See the above sample code.
Expected behavior
Passing nil
to the completion handler parameter should not produce a warning.
Environment
- Swift compiler version info:
swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
Target: x86_64-apple-macosx12.0
- Xcode version info:
Xcode 14.2
Build version 14C18
- Deployment target: iOS 16.2
nicholaslythall and lishanyu777
Metadata
Metadata
Assignees
Labels
@objcFeature → attributes: The @objc attributeFeature → attributes: The @objc attributeSILGenArea → compiler: The SIL generation stageArea → compiler: The SIL generation stageasync & awaitFeature → concurrency: asynchronous function aka the async/await patternFeature → concurrency: asynchronous function aka the async/await patternattributesFeature: Declaration and type attributesFeature: Declaration and type attributesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language featuresobjective-c interopFeature: Interoperability with Objective-CFeature: Interoperability with Objective-Cswift 5.7unexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output