There are several logical inconsistencies and traps in the current traversal.
This doesn't fix any of them, but
- describes the general expectations of how templates should be traversed
- (mostly) exhaustively records current behavior as a baseline for changes
- lists the apparent bugs in current behavior
See https://github.com/clangd/clangd/issues/1034 for an example of reasonable
code that falls into one of the traps, and some discussion.
I think this is a very useful documentation about the RAV API, instead of staying in the test file, I would suggest moving it to the RAV.h file.