[S] Change in dart/sdk[main]: BL-co19. Don't report nonFinalFieldInEnum for external fields.

0 views
Skip to first unread message

Johnni Winther (Gerrit)

unread,
May 11, 2026, 7:43:31 AM (2 days ago) May 11
to Konstantin Shcheglov, Paul Berry, dart-...@luci-project-accounts.iam.gserviceaccount.com, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Konstantin Shcheglov and Paul Berry

Johnni Winther voted and added 1 comment

Votes added by Johnni Winther

Code-Review+1

1 comment

File pkg/analyzer/lib/src/generated/error_verifier.dart
Line 5658, Patchset 2 (Latest): if (fieldDeclaration.externalKeyword != null) {
// External fields do not add stored state to the enum instance.
return;
}
var variableList = fieldDeclaration.fields;
Johnni Winther . unresolved

Maybe reverse the logic here to avoid the `return;`:

    if (fieldDeclaration.externalKeyword == null) {
var variableList = fieldDeclaration.fields;
if (!variableList.isFinal) {
...
}
}
Open in Gerrit

Related details

Attention is currently required from:
  • Konstantin Shcheglov
  • Paul Berry
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: Ia4dd616dd211be6c05b93f174785cb2b30644a72
Gerrit-Change-Number: 502420
Gerrit-PatchSet: 2
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Paul Berry <paul...@google.com>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Comment-Date: Mon, 11 May 2026 11:43:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Konstantin Shcheglov (Gerrit)

unread,
May 12, 2026, 2:19:23 PM (19 hours ago) May 12
to Johnni Winther, Paul Berry, dart-...@luci-project-accounts.iam.gserviceaccount.com, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Paul Berry

Konstantin Shcheglov voted and added 1 comment

Votes added by Konstantin Shcheglov

Commit-Queue+2

1 comment

File pkg/analyzer/lib/src/generated/error_verifier.dart
Line 5658, Patchset 2: if (fieldDeclaration.externalKeyword != null) {

// External fields do not add stored state to the enum instance.
return;
}
var variableList = fieldDeclaration.fields;
Johnni Winther . resolved

Maybe reverse the logic here to avoid the `return;`:

    if (fieldDeclaration.externalKeyword == null) {
var variableList = fieldDeclaration.fields;
if (!variableList.isFinal) {
...
}
}
Konstantin Shcheglov

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Paul Berry
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: Ia4dd616dd211be6c05b93f174785cb2b30644a72
Gerrit-Change-Number: 502420
Gerrit-PatchSet: 3
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
Gerrit-Attention: Paul Berry <paul...@google.com>
Gerrit-Comment-Date: Tue, 12 May 2026 18:19:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Johnni Winther <johnni...@google.com>
satisfied_requirement
open
diffy

dart-scoped@luci-project-accounts.iam.gserviceaccount.com (Gerrit)

unread,
May 12, 2026, 2:57:35 PM (18 hours ago) May 12
to Konstantin Shcheglov, Johnni Winther, Paul Berry, dart-analys...@google.com, rev...@dartlang.org

dart-...@luci-project-accounts.iam.gserviceaccount.com submitted the change with unreviewed changes

Unreviewed changes

2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: pkg/analyzer/lib/src/generated/error_verifier.dart
Insertions: 8, Deletions: 9.

@@ -5655,15 +5655,14 @@

if (fieldDeclaration != null) {
if (!fieldDeclaration.isStatic) {
- if (fieldDeclaration.externalKeyword != null) {
- // External fields do not add stored state to the enum instance.
- return;
- }
- var variableList = fieldDeclaration.fields;
- if (!variableList.isFinal) {
- diagnosticReporter.report(
- diag.nonFinalFieldInEnum.at(variableList.variables.first.name),
- );
+ // External fields do not add stored state to the enum instance.
+ if (fieldDeclaration.externalKeyword == null) {
+ var variableList = fieldDeclaration.fields;
+ if (!variableList.isFinal) {
+ diagnosticReporter.report(
+ diag.nonFinalFieldInEnum.at(variableList.variables.first.name),
+ );
+ }
}
}
} else if (primaryConstructor != null) {
```

Change information

Commit message:
BL-co19. Don't report nonFinalFieldInEnum for external fields.

External fields don't have storage.

Now pass:
co19/LanguageFeatures/Enhanced-Enum/grammar_A07_t01
Change-Id: Ia4dd616dd211be6c05b93f174785cb2b30644a72
Reviewed-by: Johnni Winther <johnni...@google.com>
Commit-Queue: Konstantin Shcheglov <sche...@google.com>
Files:
  • M pkg/analyzer/lib/src/generated/error_verifier.dart
  • M pkg/analyzer/test/src/diagnostics/non_final_field_in_enum_test.dart
Change size: S
Delta: 2 files changed, 10 insertions(+), 10 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Johnni Winther
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ia4dd616dd211be6c05b93f174785cb2b30644a72
Gerrit-Change-Number: 502420
Gerrit-PatchSet: 4
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Johnni Winther <johnni...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Paul Berry <paul...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages