Skip to content

Commit

Permalink
Merge pull request #1123 from hzeller/add-detail-to-check-fail
Browse files Browse the repository at this point in the history
Add more detail to a check failure seen in some Kythe indexings.
  • Loading branch information
hzeller authored Dec 13, 2021
2 parents 35f00c1 + 6d96fb4 commit 380752c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions common/text/tree_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,13 @@ const SyntaxTreeLeaf& GetSubtreeAsLeaf(const S& symbol,
E parent_must_be_node_enum,
size_t child_position) {
internal::MustBeCSTSymbolOrNode(symbol);
return SymbolCastToLeaf(*ABSL_DIE_IF_NULL(
GetSubtreeAsSymbol(symbol, parent_must_be_node_enum, child_position)));
const Symbol* subtree =
GetSubtreeAsSymbol(symbol, parent_must_be_node_enum, child_position);
// TODO(ikr): avoid this check-failure.
CHECK(subtree != nullptr)
<< symbol.Kind() << " e:" << parent_must_be_node_enum
<< " p:" << child_position;
return SymbolCastToLeaf(*subtree);
}

template <class S, class E>
Expand Down

0 comments on commit 380752c

Please sign in to comment.