sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Nested record type annotation as type argument is not parsed

Open scheglov opened this issue 3 years ago • 0 comments

@jensjoha

void f() {
  foo<List<(int, String)>>();
}

parsed as

[(21..21): A comparison expression can't be an operand of another comparison expression., (38..38): Expected an identifier.]
void f() {foo < List < (int, String) >> ();}
CompilationUnit
  declarations
    FunctionDeclaration
      returnType: NamedType
        name: SimpleIdentifier
          token: void
      name: f
      functionExpression: FunctionExpression
        parameters: FormalParameterList
          leftParenthesis: (
          rightParenthesis: )
        body: BlockFunctionBody
          block: Block
            leftBracket: {
            statements
              ExpressionStatement
                expression: BinaryExpression
                  leftOperand: BinaryExpression
                    leftOperand: SimpleIdentifier
                      token: foo
                    operator: <
                    rightOperand: SimpleIdentifier
                      token: List
                  operator: <
                  rightOperand: BinaryExpression
                    leftOperand: RecordLiteral
                      leftParenthesis: (
                      fields
                        SimpleIdentifier
                          token: int
                        SimpleIdentifier
                          token: String
                      rightParenthesis: )
                    operator: >>
                    rightOperand: ParenthesizedExpression
                      leftParenthesis: (
                      expression: SimpleIdentifier
                        token: <empty> <synthetic>
                      rightParenthesis: )
                semicolon: ;
            rightBracket: }

scheglov avatar Sep 19 '22 18:09 scheglov