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

Childen of a MemberDeclListSyntax are no longer typed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: SwiftSyntax
    • Labels:
      None
    • Environment:

      Xcode 10.2, macOS 10.14.3.

      Description

      In the Swift 4.2 release, childen of a `MemberDeclListSyntax` type were typed, thus the following code was working:

       

      let enumCaseDeclarations: [EnumCaseDeclSyntax] = enumDeclaration.members.members.children.compactMap { $0 as? EnumCaseDeclSyntax }
      

       

      But after updating to Xcode 10.2 today, which includes the Swift 5.0 release, all `children` members are of type `Syntax` and casting to `EnumCaseDeclSyntax` fails, although that's the type I'm expecting here. You can find an example Swift file being parsed here.

      Why was this API changed to be less informative? And how am I supposed to cast it to the appropriate type going forward with the 5.0 release?

      It would be great to get feedback soon, so I can make a Xcode 10.2 compatible release of my tool BartyCrouch. See also the appropriate line here.

       

      Thank you for your help in advance!

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            Dschee Cihat Gündüz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: