Skip to content

Determine if ASTGen is responsible for checking that optional tokens exist in the SwiftSyntax tree #68355

Open
@ahoppen

Description

@ahoppen

https://github.com/apple/swift/pull/67111/files#diff-de110680caa5f6af695d85ee44bc75ce4693b169e6e537ca176ec3fda17705a8R22-R29 checks that a FunctionCallExprSyntax has a left parenthesis and a right parenthesis if there are arguments. We need to figure out if it’s ASTGen’s responsibility to performs such checks.

Options are:

  1. We change the SwiftSyntax tree to make sure that the parenthesis are always present if one of the following conditions is satisfied (which might be tricky)
    a. There is a single argument in arguments or
    b. There is no trailing closure
  2. ASTGen performs these checks like it does today
  3. Since the SwiftSyntax tree is structurally valid without the left and right parenthesis, ASTGen does not need to check these invariants unless it requires the parentheses e.g. to get their locations.

I’m favoring option (3) at the moment

Metadata

Metadata

Assignees

Labels

ASTGenArea → compiler: The ASTGen module, which translates SwiftSyntax trees to the C++ ASTcompilerThe Swift compiler itself

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions