You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
No response
Describe the bug
In certain cases where we deal with generics (such as user defined generic classes), the generics between square brackets get interpreted as a subscript as opposed to a generic.
Steps To Reproduce/Bad Parse Tree
e.g in Tree-sitter playground:
x: list[int] =0y: type[int] =int
list[int] is correctly classified as a generic_type
type[int] is incorrectly classified as subscript
Alternatively for similar output:
classMyGeneric[T]:
passMyAlias=MyGeneric[int]
Expected Behavior/Parse Tree
Both cases should be generic_types.
Repro
No response
The text was updated successfully, but these errors were encountered:
The first case is definitely solvable, but the second case not so much, because it's truly ambiguous as to whether or not it's a subscript or a generic type. That would require semantic information about the code, which is typically something an interpreter/compiler/LSP does, and not tree-sitter
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version
)No response
Describe the bug
In certain cases where we deal with generics (such as user defined generic classes), the generics between square brackets get interpreted as a subscript as opposed to a generic.
Steps To Reproduce/Bad Parse Tree
list[int]
is correctly classified as ageneric_type
type[int]
is incorrectly classified assubscript
Alternatively for similar output:
Expected Behavior/Parse Tree
Both cases should be
generic_type
s.Repro
No response
The text was updated successfully, but these errors were encountered: