Uploaded image for project: 'Swift'
  1. Swift
  2. SR-9710

Return `trailing comma` value when access to `FunctionParameterSyntax.ellipsis`.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: SwiftSyntax
    • Labels:
      None
    • Environment:

      Description

      When FunctionParameterSyntax.ellipsis property access, It returned wrong token about `tokenKind.kind == "comma"`.
      You can check problem with after exec SwiftSyntax-issue-ellipsis.
      And It can check result SwiftSyntax-issue-ellipsis repository's README.

      SwiftSyntax-issue-ellipsis: https://github.com/omochi/SwiftSyntax-issue-ellipsis/blob/master/Sources/SwiftSyntax-issue-ellipsis/main.swift

      Result

       

      ccc: Int, 
      ---ellipsis---
      TokenSyntax
      , 
      ---
      no trailing comma
      Program ended with exit code: 0

       

      So, I access `ellipsis`(...), But I got `comma`(,) token.

      And I confirmed more case for $ swiftc -emit-syntax swift-syntax-source.swift result json.
      It estimates in the specifity range in gist.

      I guess that expected order of layout.

       

      Cursor  value
      Attributes null
      FirstName argument1
      SecondName null
      Colon :
      Type Int
      Ellipsis null
      DefaultArgument null
      TrailingComma ,

       

       But I got

      Cursor  value
      Attributes null
      FirstName argument1
      SecondName null
      Colon :
      Type Int
      Ellipsis ,
      DefaultArgument null
      TrailingComma null

       

      So, `Elilpsis=,` and `TrailingComma=null` are wrong result.

        Attachments

          Activity

            People

            Assignee:
            bannzai yudai.hirose
            Reporter:
            bannzai yudai.hirose
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: