Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply dart fixes to mixins #46465

Open
Piinks opened this issue Jun 24, 2021 · 5 comments
Open

Apply dart fixes to mixins #46465

Piinks opened this issue Jun 24, 2021 · 5 comments
Labels
analyzer-dartfix Issues with the dartfix package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@Piinks
Copy link
Contributor

Piinks commented Jun 24, 2021

Looking at TextSelectionDelegate, it is a mixin, so writing a fix for a deprecated member is not very clear.
I think I can write a fix for all the classes that use the mixin, but that could result in a large number of rules to write for a single mixin.
Being able to target and test mixins could streamline the process if possible. :)

@lrhn lrhn added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Jun 25, 2021
@srawlins
Copy link
Member

cc @bwilkerson

@srawlins srawlins added analyzer-dartfix Issues with the dartfix package P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug labels Jul 20, 2021
@asashour
Copy link
Contributor

asashour commented Sep 22, 2022

I guess this is data-driven-fix and not a normal quick fix.

If so, inMixin is there.

Could you please provide a minimal case if this is still valid?

@Piinks
Copy link
Contributor Author

Piinks commented Nov 29, 2023

For sure, just ran into this today. There is a deprecated method in WidgetInspectorService, which is a mixin. I wrote the following rule:

  - title: "Migrate to addPubRootDirectories"
    date: 2023-11-29
    element:
      uris: ['widgets.dart', 'material.dart', 'cupertino.dart']
      method: 'setPubRootDirectories'
      inMixin: 'WidgetInspectorService'
    changes:
      - kind: 'rename'
        newName: 'addPubRootDirectories'

with the expectation it would result in this transformation:

// Before
  class Test with WidgetInspectorService {
    Test();
  }
  final Test test = Test();
  test.setPubRootDirectories([]);

// After
  class Test with WidgetInspectorService {
    Test();
  }
  final Test test = Test();
  test.addPubRootDirectories([]);

This does not work. Am I holding it wrong? :)

@Piinks
Copy link
Contributor Author

Piinks commented Nov 29, 2023

For reference, came up in flutter/flutter#139257

@bwilkerson
Copy link
Member

It looks right to me. Probably another unimplemented part of the API.

@bwilkerson bwilkerson added P2 A bug or feature request we're likely to work on and removed P3 A lower priority bug or feature request labels Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-dartfix Issues with the dartfix package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants