Skip to content

[DeadCode] Compare switch case stmts node-by-node in RemoveDuplicatedCaseInSwitchRector - #8754

Merged
TomasVotruba merged 1 commit into
mainfrom
fix-remove-duplicated-case-array-compare
Oct 21, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
fix-remove-duplicated-case-array-compare

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

RemoveDuplicatedCaseInSwitchRector compared two case statement lists by passing the stmts arrays straight into NodeComparator::areNodesEqual(), relying on its array overload.

Compare them by length and then node-by-node via areNodesEqual(Node, Node) instead. This avoids printing the whole statement lists, benefits from the per-node class short-circuit, and no longer depends on the array overload.

…CaseInSwitchRector

Compare the two case stmt lists by length then element-wise via areNodesEqual, instead of passing the arrays to the array overload. Avoids printing the whole statement lists and no longer depends on that overload.
@TomasVotruba
TomasVotruba force-pushed the fix-remove-duplicated-case-array-compare branch from 486ae08 to 527552a Compare October 21, 2026 21:22
@TomasVotruba TomasVotruba changed the title [DeadCode] Compare switch case stmts via printWithoutComments [DeadCode] Compare switch case stmts node-by-node in RemoveDuplicatedCaseInSwitchRector Oct 21, 2026
@TomasVotruba
TomasVotruba merged commit fa38219 into main Oct 21, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the fix-remove-duplicated-case-array-compare branch October 21, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant