Skip to content

[DAS] Add enum constant fix review #61847

@FMorschel

Description

@FMorschel

I was thinking a bit more about this fix, and I have three things to talk about:

  1. It should probably get renamed to Create enum constant so it is more aligned with all other Create (extension) <member> fixes.
  2. Missing case:
enum E { a(1); const E(int i); } void f(E e) { f(E.b); // Only displays `Change to 'a'` }

(Congrats @kallentu for fixing this for dot sorthands!)

  1. When we have a constructor that takes parameters, we should create the constant and move the selection there with a null as a parameter, so the user knows they must fix it, like:
enum E { a(1); const E(int i); } void f(E e) { f(.b); // would add above `b(null)` }

Like we would for other fixes, like getter and such, where we fill:

 E get b => null;

WDYT @bwilkerson?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-quick-fixIssues with analysis server (quick) fixestype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions