tree-sitter / tree-sitter/tree-sitter-cpp
bug: gtest's ASSERT_DEBUG_DEATH not treated as an expression_statement
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 453
- Forks
- 185
- PR merge metrics
- No merged PRs in 30d
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-cpp
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
tree-sitter 0.25.8 (f2f197b6b27ce75c280c20f131d4f71e906b86f7)
Describe the bug
google test's ASSERT_DEBUG_DEATH is not treated as an expression_statement like other test macros. See the picture from the treesitter playground:
EXPECT_FALSE is correctly shown as an expression statement while ASSERT_DEBUG_DEATH leads to an error. It has to do with the initialization of the class inside the macro.
Steps To Reproduce/Bad Parse Tree
- use gtest's assert debug death macro with an initialization inside it.
- tree-sitter can't parse the code
Expected Behavior/Parse Tree
The macro is resolved to an expression statement
Repro
EXPECT_FALSE( bool );
ASSERT_DEBUG_DEATH( const class Class() , "" );
class MockStream {
public:
MockStream(){};
};
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided repro in the tree-sitter playground and compare the parse trees for EXPECT_FALSE and ASSERT_DEBUG_DEATH, focusing on the initialization inside the latter macro. The work is done when the ASSERT_DEBUG_DEATH example is parsed as an expression_statement without an error, while the surrounding class declaration remains correctly parsed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100