Query: `(MISSING)` and `(ERROR)` match despite no missing or error nodes
Problem
Queries which check for (MISSING) and (ERROR) seem to match despite the parse tree not actually containing any missing or error nodes.
Might be specific to https://tree-sitter.github.io/tree-sitter/7-playground.html (respectively generally the JavaScript bindings). I wasn't able to reproduce this locally yet with java-tree-sitter (jtreesitter), but maybe my test setup is incorrect.
Steps to reproduce
- Open https://tree-sitter.github.io/tree-sitter/7-playground.html
- Select "Java" as language, and check the "Query" and "Accessibility" checkboxes
- Enter the following valid Java source code
class A extends B { } - Enter one of the following Tree-sitter queries
(superclass (MISSING) ) @a:x: Bug: The queries match the(superclass (ERROR) ) @aextends Bpart of the source (highlighted in the source editor), despite there neither being aMISSINGnor anERRORnode.
Side note: If you replace (MISSING) with (MISSING type_identifier), then the query behaves as expected, having only a match if there is actually a MISSING node (e.g. for class A extends {}; note the missing superclass).
Expected behavior
(MISSING) and (ERROR) should only have matches if there are actually missing or error nodes.
Tree-sitter version (tree-sitter --version)
v0.25.10 (?, version of Playground)
Operating system/version
WASM
Source: tree-sitter/tree-sitter