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

Missing token classifications

    XMLWordPrintable

    Details

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

      Description

      Looks like depends on how the classification is checked, the result may be different. Let's consider this sample:

        public func testClassification1() {
          let source = """
      public final class Foo {}
      """
          let tree = try! SyntaxParser.parse(source: source)
          for token in tree.tokens {
              for classification in token.classifications {
                  print("\(token.text) - \(classification.kind)")
              }
          }
        }
      

      output:

      public - keyword
      class - keyword
      

      Missing:

      final - attribute
      

      Now let's try this sample:

          public func testClassification2() {
              let source = """
      public final class Foo {}
      """
              let tree = try! SyntaxParser.parse(source: source)
              for classification in tree.classifications {
                  print("\(classification.kind)")
              }
          }
      

      output:

      keyword
      attribute
      keyword
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            krzyzanowskim Marcin Krzyzanowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: