tree-sitter / tree-sitter-scala

Scala grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wildcards in tuple bindings

susliko opened this issue · comments

Commit of tree-sitter-scala you tested this on

d42d40c

A code sample showing the error

a.fold{ (_, a) => if (true) a }

Show the error node

(compilation_unit [0, 0] - [2, 0]
  (call_expression [0, 0] - [0, 31]
    function: (field_expression [0, 0] - [0, 6]
      value: (identifier [0, 0] - [0, 1])
      field: (identifier [0, 2] - [0, 6]))
    arguments: (block [0, 6] - [0, 31]
      (postfix_expression [0, 8] - [0, 17]
        (tuple_expression [0, 8] - [0, 14]
          (wildcard [0, 9] - [0, 10])
          (identifier [0, 12] - [0, 13]))
        (operator_identifier [0, 15] - [0, 17]))
      (ERROR [0, 18] - [0, 29]
        (if_expression [0, 18] - [0, 29]
          condition: (parenthesized_expression [0, 21] - [0, 27]
            (boolean_literal [0, 22] - [0, 26]))
          consequence: (identifier [0, 28] - [0, 29]))))))

What do you expect the tree to look like

(compilation_unit [0, 0] - [2, 0]
  (call_expression [0, 0] - [0, 31]
    function: (field_expression [0, 0] - [0, 6]
      value: (identifier [0, 0] - [0, 1])
      field: (identifier [0, 2] - [0, 6]))
    arguments: (block [0, 6] - [0, 31]
      (lambda_expression [0, 8] - [0, 29]
        parameters: (bindings [0, 8] - [0, 14]
          (binding [0, 9] - [0, 10]
            name: (wildcard [0, 9] - [0, 10]))
          (binding [0, 12] - [0, 13]
            name: (identifier [0, 12] - [0, 13])))
        (if_expression [0, 18] - [0, 29]
          condition: (parenthesized_expression [0, 21] - [0, 27]
            (boolean_literal [0, 22] - [0, 26]))
          consequence: (identifier [0, 28] - [0, 29]))))))

Where are you experiencing this error?

No response