-
-
Notifications
You must be signed in to change notification settings - Fork 130
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-typescript
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version
)
No response
Describe the bug
Call expression of type template_call
doesn't have optional type_arguments
resulting in failed parsing of such call. Libraries like kysely use typed template calls for typed sql
expressions.
Steps To Reproduce/Bad Parse Tree
Currently, repro being parsed as this tree:
(program [0, 0] - [1, 0]
(lexical_declaration [0, 0] - [0, 40]
(variable_declarator [0, 6] - [0, 40]
name: (identifier [0, 6] - [0, 12])
value: (binary_expression [0, 15] - [0, 40]
left: (binary_expression [0, 15] - [0, 26]
left: (identifier [0, 15] - [0, 18])
right: (identifier [0, 19] - [0, 26]))
right: (template_string [0, 27] - [0, 40]
(string_fragment [0, 28] - [0, 39]))))))
Expected Behavior/Parse Tree
This is how it should be parsed
(program [0, 0] - [1, 0]
(lexical_declaration [0, 0] - [0, 41]
(variable_declarator [0, 6] - [0, 41]
name: (identifier [0, 6] - [0, 12])
value: (call_expression [0, 16] - [0, 41]
function: (identifier [0, 16] - [0, 19])
type_arguments: (type_arguments [0, 19] - [0, 28]
(predefined_type [0, 20] - [0, 27]))
arguments: (template_string [0, 28] - [0, 41]
(string_fragment [0, 29] - [0, 40]))))))
Repro
const result = sql<boolean>`select true`