Conversation
f7a6366 to
7a52914
Compare
TomerStarkware
left a comment
There was a problem hiding this comment.
@TomerStarkware reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on eytan-starkware).
PR SummaryLow Risk Overview In Formatter tests add Reviewed by Cursor Bugbot for commit 7a52914. Bugbot is set up for automated code reviews on this repo. Configure here. |

Summary
Fixes incorrect sorting of nested
usepath groups containingMultivariants.The
compare_use_pathsfunction previously fell back to an empty string when comparingMultiuse path variants, causing incorrect sort ordering for groups like{self, m}and{a, m}. The comparison now recurses viacompare_use_pathsitself to find the minimum child path, producing a correct and stable ordering.Type of change
Please check one:
Why is this change needed?
When sorting nested
useimport groups, theMultivariant was assigned an empty string as its sort key instead of being compared recursively. This causeduse x::{{self, m}, {a, m}};and similar patterns to be ordered incorrectly.What was the behavior or documentation before?
Nested
usepath groups withMultivariants were compared using an empty string fallback, so their relative ordering was undefined and incorrect. For example,{self, m}and{a, m}were not sorted by their actual minimum child paths.What is the behavior or documentation after?
Nested
usepath groups are sorted by recursively comparing their minimum child paths usingcompare_use_paths, producing a correct and stable ordering. The expected sort order for several existing test cases is also corrected as a result.Related issue or discussion (if any)
None.
Additional context
A new test case
use x::{{self, m}, {a, m}};is added tosort_inner_use.cairoto cover the previously broken multi-group comparison. Theget_min_childclosure is simplified by replacing the manual key extraction with a direct call tocompare_use_paths, removing the need for theempty_stringfallback variable.