Incorrectly generated header documentation when using comments

Originator:bas.broek
Number:rdar://47733769 Date Originated:01-Feb-2019 02:29 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 10.1
Classification:Other Bug Reproducible:Always
 
Summary:
When a multi-parameter function signature includes comments, it will incorrectly generate the header documentation boilerplate, overriding actual parameters with these comments

Steps to Reproduce:
Create the following function:

```swift
func hello(
    name: String, /* ABC: make this a concrete type */
    lastName: String /* DEF: make this a concrete type */
) -> String {
    return "Hello, \(name) \(lastName)!"
}
```

then hit ⌥+⌘+/ (Editor -> Structure -> Add Documentation

Expected Results:
It should create the following header:

```swift
/// <#Description#>
///
/// - Parameters:
///   - name: <#name description#>
///   - lastName: <#lastName description#>
/// - Returns: <#return value description#>
```

Actual Results:
It returns the following header:

```swift
/// <#Description#>
///
/// - Parameters:
///   - name: <#name description#>
///   - ABC: <#ABC description#>
/// - Returns: <#return value description#>
```

Version:
Xcode 10.1

Notes:
This only seems to happen with a multi-parameter function.

This, for example, works as expected:

```swift
func hello(
    name: String // FIXME: make this a concrete type
) -> String {
    return "Hello, \(name)!"
}
```

and generates

```swift
/// <#Description#>
///
/// - Parameter name: <#name description#>
/// - Returns: <#return value description#>
```

It should also be noted that in the breaking example, only the second parameter breaks, using the “ABC” as its “parameter name”. The second parameter is ignored.

It does not matter if you are using a double slash or a opening-and-closing comment style.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!