Multiline infix method call in for-comprehension fails to parse
jpaju opened this issue · comments
Commit of tree-sitter-scala you tested this on
A code sample showing the error
There are many variants that fail to parse:
for {
_ <- ZIO.unit *>
ZIO.unit
} yield ()
for
_ <- ZIO.unit *>
ZIO.unit
yield ()
for _ <- ZIO.unit *>
ZIO.unit
yield ()
Show the error node
This is the AST of the first example above:
(compilation_unit [0, 0] - [5, 0]
(ERROR [0, 0] - [5, 0]
(enumerators [1, 2] - [5, 0]
(enumerator [1, 2] - [1, 18]
(wildcard [1, 2] - [1, 3])
(postfix_expression [1, 7] - [1, 18]
(field_expression [1, 7] - [1, 15]
value: (identifier [1, 7] - [1, 10])
field: (identifier [1, 11] - [1, 15]))
(operator_identifier [1, 16] - [1, 18])))
(ERROR [2, 9] - [3, 10]
(case_class_pattern [2, 9] - [3, 10]
type: (stable_type_identifier [2, 9] - [2, 17]
(identifier [2, 9] - [2, 12])
(type_identifier [2, 13] - [2, 17]))
(ERROR [3, 0] - [3, 7]))))))
What do you expect the tree to look like
(compilation_unit [0, 2] - [4, 0]
(for_expression [0, 2] - [2, 12]
enumerators: (enumerators [1, 4] - [3, 2]
(enumerator [1, 4] - [1, 29]
(wildcard [1, 4] - [1, 5])
(infix_expression [1, 9] - [1, 29]
left: (field_expression [1, 9] - [1, 17]
value: (identifier [1, 9] - [1, 12])
field: (identifier [1, 13] - [1, 17]))
operator: (operator_identifier [1, 18] - [1, 20])
right: (field_expression [2, 9] - [2, 16]
value: (identifier [2, 9] - [2, 12])
field: (identifier [2, 13] - [2, 17])))))
body: (unit [3, 9] - [3, 11])))
Where are you experiencing this error?
Both Helix and tree-sitter CLI
Ohh, true. I'll close this one 👍🏼