[L] Change in dart/sdk[main]: Clean up the prefer_initializing_formals lint.

0 views
Skip to first unread message

Bob Nystrom (Gerrit)

unread,
Jan 8, 2026, 8:08:02 PM (2 days ago) Jan 8
to Phil Quitslund, Brian Wilkerson, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson and Phil Quitslund

Bob Nystrom voted

Auto-Submit+1
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Phil Quitslund
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I8fbfb8071f0dc32c57b8d0ae0a0eb7c76bb0c307
Gerrit-Change-Number: 471642
Gerrit-PatchSet: 1
Gerrit-Owner: Bob Nystrom <rnys...@google.com>
Gerrit-Reviewer: Bob Nystrom <rnys...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Phil Quitslund <pquit...@google.com>
Gerrit-Attention: Phil Quitslund <pquit...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 01:07:59 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
open
diffy

Phil Quitslund (Gerrit)

unread,
Jan 8, 2026, 8:55:27 PM (2 days ago) Jan 8
to Bob Nystrom, Commit Queue, Brian Wilkerson, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Bob Nystrom and Brian Wilkerson

Phil Quitslund voted and added 2 comments

Votes added by Phil Quitslund

Code-Review+1

2 comments

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Phil Quitslund . resolved

Nice!

File pkg/linter/lib/src/rules/prefer_initializing_formals.dart
Line 1, Patchset 1 (Latest):// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
Phil Quitslund . unresolved

Sad build is saying you need to sort this. (Search for the "Sort Members" command in the IDE.)

Open in Gerrit

Related details

Attention is currently required from:
  • Bob Nystrom
  • Brian Wilkerson
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I8fbfb8071f0dc32c57b8d0ae0a0eb7c76bb0c307
Gerrit-Change-Number: 471642
Gerrit-PatchSet: 1
Gerrit-Owner: Bob Nystrom <rnys...@google.com>
Gerrit-Reviewer: Bob Nystrom <rnys...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Phil Quitslund <pquit...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Attention: Bob Nystrom <rnys...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 01:55:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Brian Wilkerson (Gerrit)

unread,
Jan 9, 2026, 11:04:38 AM (2 days ago) Jan 9
to Bob Nystrom, Brian Wilkerson, Phil Quitslund, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Bob Nystrom

Brian Wilkerson voted and added 1 comment

Votes added by Brian Wilkerson

Code-Review+1

1 comment

File pkg/linter/lib/src/rules/prefer_initializing_formals.dart
Line 140, Patchset 1 (Latest): // TODO(rnystrom): How can this ever be false?
Brian Wilkerson . resolved

Good question. It probably can't be. The usual answer to a question like this is "invalid code", but I can't think of any way for invalid code to produce this situation. I would expect that if the name after `this` isn't defined in the current class that the analyzer would set the `field` to `null`.

If removing the test doesn't cause any tests to fail, then I think it's safe to assume that it isn't needed (though Konstantin might know of a path I'm not thinking of).

Open in Gerrit

Related details

Attention is currently required from:
  • Bob Nystrom
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I8fbfb8071f0dc32c57b8d0ae0a0eb7c76bb0c307
Gerrit-Change-Number: 471642
Gerrit-PatchSet: 1
Gerrit-Owner: Bob Nystrom <rnys...@google.com>
Gerrit-Reviewer: Bob Nystrom <rnys...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Phil Quitslund <pquit...@google.com>
Gerrit-Attention: Bob Nystrom <rnys...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 16:04:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Bob Nystrom (Gerrit)

unread,
Jan 9, 2026, 6:04:47 PM (2 days ago) Jan 9
to Brian Wilkerson, Phil Quitslund, Commit Queue, dart-analys...@google.com, rev...@dartlang.org

Bob Nystrom voted and added 2 comments

Votes added by Bob Nystrom

Auto-Submit+1

2 comments

File pkg/linter/lib/src/rules/prefer_initializing_formals.dart
Line 1, Patchset 1:// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
Phil Quitslund . resolved

Sad build is saying you need to sort this. (Search for the "Sort Members" command in the IDE.)

Bob Nystrom

Done

Line 140, Patchset 1: // TODO(rnystrom): How can this ever be false?
Brian Wilkerson . resolved

Good question. It probably can't be. The usual answer to a question like this is "invalid code", but I can't think of any way for invalid code to produce this situation. I would expect that if the name after `this` isn't defined in the current class that the analyzer would set the `field` to `null`.

If removing the test doesn't cause any tests to fail, then I think it's safe to assume that it isn't needed (though Konstantin might know of a path I'm not thinking of).

Bob Nystrom

It turns out there is one test that fails if I comment this out. But it's only the test that the lint shouldn't fire if the assigned-to "field" is actually a setter. For that test, it's only the `field.isOriginDeclaration` part that matters. The other `enclosingElement` stuff doesn't seem to come into play.

I updated the comment and removed that unused half of the conditional.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I8fbfb8071f0dc32c57b8d0ae0a0eb7c76bb0c307
Gerrit-Change-Number: 471642
Gerrit-PatchSet: 3
Gerrit-Owner: Bob Nystrom <rnys...@google.com>
Gerrit-Reviewer: Bob Nystrom <rnys...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Phil Quitslund <pquit...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 23:04:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Phil Quitslund <pquit...@google.com>
Comment-In-Reply-To: Brian Wilkerson <brianwi...@google.com>
satisfied_requirement
open
diffy

Bob Nystrom (Gerrit)

unread,
Jan 9, 2026, 6:05:09 PM (2 days ago) Jan 9
to Brian Wilkerson, Phil Quitslund, Commit Queue, dart-analys...@google.com, rev...@dartlang.org

Bob Nystrom voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I8fbfb8071f0dc32c57b8d0ae0a0eb7c76bb0c307
Gerrit-Change-Number: 471642
Gerrit-PatchSet: 3
Gerrit-Owner: Bob Nystrom <rnys...@google.com>
Gerrit-Reviewer: Bob Nystrom <rnys...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Phil Quitslund <pquit...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 23:05:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages