Skip to content

[Dot Shorthands] ReplaceWithVar fix - Remove unnecessary .new in fix #61164

@kallentu

Description

@kallentu

Follow up from https://dart-review.googlesource.com/c/sdk/+/441320

We insert the type on the constructor in the ReplaceWithVar fix and we should tweak it to handle unnamed constructors better.
For example:

class E {}
E f() {
  ^E e = .new();
  return e;
}

Currently, the fix for the above is:

class E {}
E f() {
  var e = E.new(); // E() instead
  return e;
}

We'd like E(); instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-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