Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

fix(rome_analyze): handle find_diff_range in case tokens were only removed #2694

Merged
merged 1 commit into from
Jun 10, 2022

Conversation

leops
Copy link
Contributor

@leops leops commented Jun 10, 2022

Summary

This PR fixes #2693 by ensuring the start and end of the range returned by find_diff_range do not cross. This can happen if the only difference between the previous and new syntax trees are removed tokens: the results of the linear search for the start and end of the range will cross as the new range starts at the start of the new different token from the start of the tree, and ends at the end of the first different token from the end of the tree. In the case of a removal these will be the first token after the removal, and last token before the removal respectively.

Test Plan

I added a new diff_range_remove test to verify this case is handled correctly

@leops leops temporarily deployed to aws June 10, 2022 08:08 Inactive
@IWANABETHATGUY
Copy link
Contributor

Thanks

@github-actions
Copy link

@ematipico ematipico changed the title fix(rome_analyze): fix the find_diff_range in case tokens were only removed fix(rome_analyze): handle find_diff_range in case tokens were only removed Jun 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 panic when noDebugger testing
3 participants