Skip to content

prefer_final_fields incorrectly warns in part of scenario #59219

@goderbauer

Description

@goderbauer

one.dart:

library one;

part "two.dart";

void foo() {
  Foo foo = Foo._(1);
  foo._foo = 3;
  print(foo._foo);
}

two.dart:

part of one;

class Foo {
  Foo._(this._foo);

  int _foo; // 🔥 incorrect `prefer_final_fields` warning
}

Foo._foo in two.dart is being written to from one.dart, so it cannot be final and the lint should not trigger.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work ondevexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.linter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.linter-set-recommended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions