-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Description
Retrieving a structured documentation comment for a function with a parameter whose name uses raw identifiers that contains a colon :
doesn't work.
Reproduction
This could be easily reproduced using by triggering the SourceKit's Cursor Info against function foo
or bar
.
/// - Parameters:
/// - `a: b`: The first parameter.
func foo(`a: b`: Int) {}
/// - Parameter `a: b`: The first parameter.
func bar(`a: b`: Int) {}
The (formatted) output XML documentation for function foo
is:
<Function file="<...>/File.swift" line="3" column="6">
<Name>foo(a: b:)</Name>
<USR>s:4File3foo0015ab_BcaJIIBtnfaeySi_tF</USR>
<Declaration>func foo(`a: b`: Int)</Declaration>
<CommentParts></CommentParts>
</Function>
Notice that CommentParts
is empty.
The same behavior occurs if we omit the backticks surrounding the parameter name in the doc comment as follows:
/// - Parameters:
/// - a: b: The first parameter.
func foo(`a: b`: Int) {}
/// - Parameter a: b: The first parameter.
func bar(`a: b`: Int) {}
as the parameter name gets parsed as the thing before the first :
which would be just a
instead of a: b
for both foo
and bar
.
Expected behavior
Parameter documentation is parsed and returned correctly for parameters names that use raw identifiers and contain a colon :
.
Environment
Apple Swift version 6.2-dev (LLVM 0bd84aacb66971d, Swift 0839675)
Target: arm64-apple-macosx15.0
Build config: +assertions
Additional information
No response