Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
Compiled from main
Describe the bug
I am trying to parse some code with union types with more than 2 possible types and TreeSitter python does not seems to manage this right.
Steps To Reproduce/Bad Parse Tree
Here is the minimal example I can produce:
def f( arg: IO[bytes] | int | float ): pass
Here is what I get:
We see a union_type node with two types. I was expecting 3.
This is even worst with this piece of code:
def f( arg: IO[bytes] | int | List[int] ): pass
We end up with a subscript for List[int] instead of a generic type
Expected Behavior/Parse Tree
Instead of the binary_operator node containing identifiers I was expecting the union_type to contain 2..n children. Currently union_type seems to be possible only with 2 children.
Repro
I used Pharo-Tree-Sitter integration to produce the tree from this piece of code:
def f( arg: IO[bytes] | int | List[int] ): pass
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version)Compiled from main
Describe the bug
I am trying to parse some code with union types with more than 2 possible types and TreeSitter python does not seems to manage this right.
Steps To Reproduce/Bad Parse Tree
Here is the minimal example I can produce:
Here is what I get:
We see a union_type node with two types. I was expecting 3.
This is even worst with this piece of code:
We end up with a subscript for
List[int]instead of a generic typeExpected Behavior/Parse Tree
Instead of the binary_operator node containing identifiers I was expecting the union_type to contain 2..n children. Currently union_type seems to be possible only with 2 children.
Repro