Open
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
Metadata
Metadata
Assignees
Labels
Feature → attributes: The @objc attributeArea → compiler: The SIL generation stageFeature → concurrency: asynchronous function aka the async/await patternFeature: Declaration and type attributesA deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfFeature: umbrella label for concurrency language featuresFeature: Interoperability with Objective-CBug: Unexpected behavior or incorrect output