Skip to content

prefer_const_constructors false positive #57706

Closed
@apwilson

Description

@apwilson

The following code triggers the prefer_const_constructors linter rule on the initial assignment of foo:

///
class Foo {
  ///
  const Foo();
}

///
class Bar {
  ///
  Foo foo = Foo();    // Triggers prefer_const_constructors

  ///
  set changeFoo(Foo newFoo) {
    foo = newFoo;
  }
}

As I thought new/const was optional and inferred, this appears to be a false positive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions