Skip to content

Parse tree regression in return statement for void function #851

Description

@jpsim

Issue Kind

Parse of Valid Source Produced Invalid Syntax Tree

Source Code

final class SearchMessagesDataSource: ValueCellDataSource {
  internal enum Section: Int {
    case emptyState
    case messageThreads
  }

  internal func load(messageThreads: [MessageThread]) {
    self.set(
      values: messageThreads,
      cellClass: MessageThreadCell.self,
      inSection: Section.messageThreads.rawValue
    )
  }

  internal func emptyState(isVisible: Bool) {
    self.set(
      cellIdentifiers: isVisible ? ["SearchMessagesEmptyState"] : [],
      inSection: Section.emptyState.rawValue
    )
  }

  internal override func configureCell(tableCell cell: UITableViewCell, withValue value: Any) {
    switch (cell, value) {
    case let (cell as MessageThreadCell, value as MessageThread):
      cell.configureWith(value: value)
    case (is StaticTableViewCell, is Void):
      return
    default:
      assertionFailure("Unrecognized combo: \(cell), \(value).")
    }
  }
}

Description

SwiftSyntax @ 0.50700.0 : before.txt

SwiftSyntax @ 322559c : after.txt

So with the 5.7 release, the ReturnStmtSyntax.expression is nil but with the SwiftParser it's a MissingExprSyntax.

5.7 Parser Swift Parser
image image

Metadata

Metadata

Assignees

No one assigned

    Labels

    SwiftParserBugs in the (new) Parser written in Swift

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions