Closed apazzolini closed 8 months ago
I narrowed the cause to the addition of this rule, perhaps it messes up with token precedence
https://github.com/tree-sitter/tree-sitter-typescript/blob/d847898fec3fe596798c9fda55cb8c05a799001a/common/define-grammar.js#L928
Without it <const>
is parsed properly, but Functions with typed parameters
test fails.
The following piece of code is valid (when JSX is disabled) but it is parsed incorrectly:
Here's a link to the TypeScript Playground showing that the snippet above is valid JavaScript or TypeScript: https://www.typescriptlang.org/play?target=99&jsx=0&ts=5.2.2&ssl=1&ssc=33&pln=1&pc=1#code/MYewdgzgLgBAHjAvDAPKSUB8BvGBDALhgEYAaGAIyICYYBfAbiA
The output of
tree-sitter parse
is the following: (I copied this from the TS playground in nvim, I assume it's the same thing? Let me know if not and I'll figure out how to use thetree-sitter
binary)I bisected the change and #252 seems to have introduced the bug. Prior to that PR, the code is parsed as
Thanks!