Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
tree-sitter 0.25.9
Describe the bug
Similar to #322 , keyof with import expressions in type annotations are not parsed properly.
Steps To Reproduce/Bad Parse Tree
let foo: keyof import('a').A;
(program [0, 0] - [1, 0]
(lexical_declaration [0, 0] - [0, 29]
(variable_declarator [0, 4] - [0, 7]
name: (identifier [0, 4] - [0, 7]))
(ERROR [0, 7] - [0, 28]
(member_expression [0, 15] - [0, 28]
object: (call_expression [0, 15] - [0, 26]
function: (import [0, 15] - [0, 21])
arguments: (arguments [0, 21] - [0, 26]
(string [0, 22] - [0, 25]
(string_fragment [0, 23] - [0, 24]))))
property: (property_identifier [0, 27] - [0, 28])))))
Expected Behavior/Parse Tree
(program [0, 0] - [1, 0]
(lexical_declaration [0, 0] - [0, 29]
(variable_declarator [0, 4] - [0, 28]
name: (identifier [0, 4] - [0, 7])
type: (type_annotation [0, 7] - [0, 28]
(index_type_query [0, 9] - [0, 28]
(member_expression [0, 15] - [0, 28]
object: (call_expression [0, 15] - [0, 26]
function: (import [0, 15] - [0, 21])
arguments: (arguments [0, 21] - [0, 26]
(string [0, 22] - [0, 25]
(string_fragment [0, 23] - [0, 24]))))
property: (property_identifier [0, 27] - [0, 28])))))))
Or, this tree might be different if a node other than call_expression is used to parse import calls (which, imo, it should, since import expressions are different than call expressions in the ecmascript spec, and they're also treated specially in typescript type annotations. but that could be a different fix.
Repro
let foo: keyof import('a').A;
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version)tree-sitter 0.25.9
Describe the bug
Similar to #322 ,
keyofwithimportexpressions in type annotations are not parsed properly.Steps To Reproduce/Bad Parse Tree
let foo: keyof import('a').A;Expected Behavior/Parse Tree
Or, this tree might be different if a node other than
call_expressionis used to parseimportcalls (which, imo, it should, sinceimportexpressions are different than call expressions in the ecmascript spec, and they're also treated specially in typescript type annotations. but that could be a different fix.Repro