Closed sguillia closed 8 months ago
thanks for the report!
Just found out the error has nothing to do with the comment
It seems to confuse method signatures and definitions.
class Vec {
method() { } // METHOD_DEFINITION
}
class Vec {
method() // METHOD_SIGNATURE
{ } // ERROR
}
I tried adding optional($._automatic_semicolon)
after this line, but I don't know how to resolve the induced conflict
Running prettier on those files fixes the issue, except if there is a comment between the method name and body.
This was fixed in https://github.com/tree-sitter/tree-sitter-typescript/issues/140 and the tests are still there
Plus the examples work in the playground (https://tree-sitter.github.io/tree-sitter/playground).
Are you sure this isn't coming from an outdated version of tree-sitter? Perhaps the playground wasn't updated yet when you first tried.
The following piece of code is valid 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?#code/MYGwhgzhAEBqCmxoG8BQBIYB7AdhALgE4Cuw+WhAFAJQYD0d02Ats-DvhstAL6p9A
The output of
tree-sitter parse
is the following (on commit 11f8f151327e99361c1ff6764599daeef8633615):I ran
tree-sitter parse
with the following versions (tree-sitter --version
):I am not sure why
tree-sitter parse
does not showERROR
, but the tree-sitter playground and my application do find an error nodeI tried with both node and wasm bindings, both give error nodes.