Skip to content

[CP] Fixes multiple fixes for insertions in multi-file library #59853

@FMorschel

Description

@FMorschel

Commit(s) to merge

https://dart-review.googlesource.com/c/sdk/+/401865

Target

Stable

Prepared changelist for beta/stable

https://dart-review.googlesource.com/c/sdk/+/403380

Issue Description

All platforms are affected.

The dart fix command applies insertions for all files in the library after #55520. This means that in a library with two files if we have errors on both and one of them has an insertion fix (say adding const ), that insertion is added twice.

The desired behaviour is to only do so for the current file since it runs for every file anyway. The initial issue was about detecting the fixes needed for part files but it didn't consider only fixing for a single file at a time, as it was doing previously.

What is the fix

The fix removes the loop for all units in the library and only runs for the unit with the current path.

Why cherry-pick

It creates errors in code fixes.

Risk

The risk of merging is low.

Issue link(s)

#59572

Extra Info

CC @pq

Metadata

Metadata

Labels

area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.cherry-pick-approvedLabel for approved cherrypick requestcherry-pick-mergedCherry-pick has been merged to the stable or beta branch.cherry-pick-reviewIssue that need cherry pick triage to approvetype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions