Skip to content

dart fix applies fixes in part files mutliple times #59572

@denniskaselow

Description

@denniskaselow

Dart SDK version: 3.7.0-157.0.dev (dev) (Sat Nov 16 12:03:16 2024 -0800) on "windows_x64"

Running dart fix --apply on this code will apply the fixes in b.dart multiple times:

// a.dart
part 'b.dart';

void a() {
  // need to trigger a lint in a.dart for the bug to happen
  ;
  b();
}

// b.dart
part of 'a.dart';

Stream<String> b() {
  // dart fix should only add a single const
  return Stream.empty();
}
# analysis_options.yaml
linter:
  rules:
    - empty_statements
    - prefer_const_constructors

The fix adds const 3 times in b.dart:

part of 'a.dart';

Stream<String> b() {
  // dart fix should only add a single const
  return const const const Stream.empty();
}

Output of dart fix --apply:

Applying fixes...

lib\a.dart
  empty_statements • 1 fix

lib\b.dart
  prefer_const_constructors • 3 fixes

It's not limited to these lints. For example the fix for require_trailing_commas would add multiple commas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work ondevexp-bulk-fixdevexp-quick-fixIssues with analysis server (quick) fixeslegacy-area-analyzerUse area-devexp instead.type-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