Fix invalid parse stack recursive merging with mismatched error cost
Allowing this invalid merge caused an invariant to be violated later on during parsing, when handling a later error. Co-authored-by: Amaan Qureshi <amaanq12@gmail.com> Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
parent
eb35502f06
commit
9b485924d6
1 changed files with 2 additions and 1 deletions
|
|
@ -228,7 +228,8 @@ static void stack_node_add_link(
|
|||
// If the previous nodes are mergeable, merge them recursively.
|
||||
if (
|
||||
existing_link->node->state == link.node->state &&
|
||||
existing_link->node->position.bytes == link.node->position.bytes
|
||||
existing_link->node->position.bytes == link.node->position.bytes &&
|
||||
existing_link->node->error_cost == link.node->error_cost
|
||||
) {
|
||||
for (int j = 0; j < link.node->link_count; j++) {
|
||||
stack_node_add_link(existing_link->node, link.node->links[j], subtree_pool);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue