sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[analyzer] no data driven fixes when package name doesn't match the folder name

Open asashour opened this issue 3 years ago • 0 comments

On looking at #50011, whether to find a fix or not, seems to be dependent on the match between the package name and folder name.

Steps:

  1. Create a new Dart project named aaa in aaa folder
  2. Add lib/fix_data.yaml (content below)
  3. Add lib/rendering.dart (content below)
  4. Add test/some_test.dart (content below)
  5. dart fix --dry-run proposed 1 fix
  6. Rename package to bbb in pubspec.yaml
  7. dart pub get
  8. Change import package to bbb in the test file.
  9. dart fix --dry-run doesn't find any fix.

Is this an expected behavior?

Dart SDK version: 2.19.0-215.0.dev (dev) (Sun Sep 18 20:34:31 2022 -0700) on "windows_x64"

version: 1
transforms:
  - title: "Migrate to 'RenderConstraintsTransformBox'"
    date: 2021-03-24
    element:
      uris: [ 'rendering.dart' ]
      constructor: ''
      inClass: 'Old'
    changes:
      - kind: 'replacedBy'
        newElement:
          uris: [ 'rendering.dart' ]
          constructor: ''
          inClass: 'New'
@deprecated
class Old {
  @deprecated
  Old();
}

class New {}
import 'package:aaa/rendering.dart';

void f() {
  Old c = Old();
}

asashour avatar Sep 21 '22 07:09 asashour