-
-
Notifications
You must be signed in to change notification settings - Fork 217
Open
Labels
Description
Did you check existing issues?
- I have read all the tree-sitter docs if it relates to using the parser
- I have searched the existing issues of tree-sitter-python
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 ): passHere 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] ): passReactions are currently unavailable