swiftlang/swift

[SR-3162] Generated ObjC header doc generate warnings when closure parameters are documented

Open

#45,750 opened on 2016年11月8日

GitHub で見る
 (4 comments) (0 reactions) (0 assignees)Swift (69,989 stars) (10,719 forks)batch import
PrintAsClangbugcompilergood first issue

説明

Previous ID SR-3162
Radar rdar://problem/29162619
Original Reporter @belkadan
Type Bug
Votes 0
Component/s Compiler
Labels Bug, PrintAsObjC, StarterBug
Assignee None
Priority Medium

md5: 78bb297fbc54491dc1e3f572b5cb816a

Issue Description:

Given this Swift definition:

    /// Writes to an output stream
    ///
    /// - Parameters:
    ///   - outputStream: The output stream to write to
    ///   - completionQueue: The completion queue to call your completion handler on. If `nil` the main queue is used.
    ///   - completion: A completion handler called after the data is written or an error is thrown.
    ///   - error: If successful this will be `nil`, otherwise contains the error thrown.
    public func writeTheThing(
        outputStream: OutputStream,
        completionQueue: DispatchQueue = DispatchQueue.main,
        completion: @escaping (_ error: Error?) -> Void) {}

This Objective-C definition is generated:

/**
  Writes to an output stream
  \param outputStream The output stream to write to

  \param completionQueue The completion queue to call your completion handler on. If \code
  nil
  \endcode the main queue is used.

  \param completion A completion handler called after the data is written or an error is thrown.

  \param error If successful this will be \code
  nil
  \endcode, otherwise contains the error thrown.

*/
- (void)writeTheThingWithOutputStream:(NSOutputStream * _Nonnull)outputStream completionQueue:(OS_dispatch_queue * _Nonnull)completionQueue completion:(void (^ _Nonnull)(NSError * _Nullable))completion;

The result is when the Project-Swift.h file is imported in Objective-C the “error” parameter generates a warning because it isn’t a valid parameter name in ObjC headerdoc comments.

コントリビューターガイド