[dart-lang/sdk] baa6cd: DeCo. Add Scope.visitEnumDeclaration / visitClassT...

0 views
Skip to first unread message

Konstantin Scheglov

unread,
Feb 23, 2026, 6:33:17 PM (13 hours ago) Feb 23
to com...@dartlang.org
Branch: refs/heads/main
Home: https://github.com/dart-lang/sdk
Commit: baa6cd6eb98eaf256e17a5ebab3ac6cb5aae530e
https://github.com/dart-lang/sdk/commit/baa6cd6eb98eaf256e17a5ebab3ac6cb5aae530e
Author: Konstantin Shcheglov <sche...@google.com>
Date: 2026-02-23 (Mon, 23 Feb 2026)

Changed paths:
M pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
M pkg/analyzer/lib/src/dart/resolver/scope_context.dart
M pkg/analyzer/lib/src/generated/resolver.dart
M pkg/analyzer/lib/src/summary2/reference_resolver.dart
M pkg/analyzer/test/src/dart/resolution/class_test.dart
M pkg/analyzer/test/src/dart/resolution/enum_test.dart

Log Message:
-----------
DeCo. Add Scope.visitEnumDeclaration / visitClassTypeAlias

Introduce ScopeContext.visitEnumDeclaration and visitClassTypeAlias to
centralize the standard scoping/visitation order for these declarations,
including type-parameter scope, instance scope, and documentation
comment handling.

Refactor ResolutionVisitor, ScopeResolverVisitor, and ReferenceResolver
to use the new helpers, reducing duplicated scope plumbing and keeping
the three resolver phases consistent.

Fix enum primary-constructor formal parameters being visited outside the
body scope, which could resolve annotations and type names against the
library scope rather than enum members (for example, when static members
shadow outer names).

Change-Id: I2ea8335ac6a225a13b5498ffda0a0bcb1ac9b889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482961
Reviewed-by: Paul Berry <paul...@google.com>
Commit-Queue: Konstantin Shcheglov <sche...@google.com>



To unsubscribe from these emails, change your notification settings at https://github.com/dart-lang/sdk/settings/notifications

Konstantin Scheglov

unread,
Feb 23, 2026, 7:38:08 PM (12 hours ago) Feb 23
to com...@dartlang.org
Branch: refs/heads/lkgr
Commit: bf5756b5a039324921da4426d631e4ed5b094dcb
https://github.com/dart-lang/sdk/commit/bf5756b5a039324921da4426d631e4ed5b094dcb
Author: Konstantin Shcheglov <sche...@google.com>
Date: 2026-02-23 (Mon, 23 Feb 2026)

Changed paths:
M pkg/analyzer/lib/src/dart/element/extensions.dart
M pkg/analyzer/lib/src/dart/element/scope.dart
M pkg/analyzer/lib/src/dart/resolver/scope_context.dart

Log Message:
-----------
DeCo. Give LocalScope and FormalParameterScope instance of FeatureSet.

Thread the library FeatureSet into LocalScope and FormalParameterScope
so wildcard handling can be decided directly from the active language
features.

This removes reliance on per-element `isWildcardVariable` checks (which
require digging through element/library state) and centralizes the
`wildcard_variables` gate in scope construction and mutation.

Also:
- Drop the now-unneeded nullable `Element?.isWildcardVariable` helper.
- Remove the extensions import from scope.dart and add lightweight
assertions around LocalScope inputs.

Change-Id: I3a0f2e0528464c48a0b944590eb4dcee918a12e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482982
Reviewed-by: Paul Berry <paul...@google.com>
Commit-Queue: Konstantin Shcheglov <sche...@google.com>


Compare: https://github.com/dart-lang/sdk/compare/948ad371bf7b...bf5756b5a039

copybara-service[bot]

unread,
Feb 23, 2026, 11:06:42 PM (9 hours ago) Feb 23
to com...@dartlang.org
Branch: refs/heads/dev
Commit: c116ea6c55509cd523e44601374bcaa218fa1a09
https://github.com/dart-lang/sdk/commit/c116ea6c55509cd523e44601374bcaa218fa1a09
Author: Paul Berry <paul...@google.com>
Date: 2026-02-23 (Mon, 23 Feb 2026)

Changed paths:
M pkg/_fe_analyzer_shared/test/mini_ast.dart

Log Message:
-----------
[flow analysis] In tests, improve plumbing of flow analysis info.

Makes the following updates to the mini_ast used for flow analysis
testing:

- When visiting a `Write` node, the flow analysis expression info is
pulled directly from the analysis result of the RHS and passed to
`_visitWrite`, rather than deferring to `_visitWrite` to look it up
using `getFlowAnalysisInfo`.

- When computing the promoted type or the promotion chain of a
`Property` node, the flow analysis expression info is pulled
directly from the analysis result of the target (by
`_computeMemberAndFlowAnalysisInfo`) rather than looking it up using
`getFlowAnalysisInfo`.

- When creating the guard variable for a null-aware property access or
method call, the result of analyzing the target is passed directly
to `createNullAwareGuard`, allowing it to obtain the flow analysis
expression info directly rather than fetching it from
`getFlowAnalysisInfo`. The modified expression info for the
null-checked target is then returned directly back to the caller
using another analysis result, rather than requiring the caller to
look it up using another call to `getFlowAnalysisInfo`.

These changes pave the way for removing the `getFlowAnalysisInfo` and
`storeFlowAnalysisInfo` methods from mini_ast, along with the map they
use for storage.

Change-Id: I6a6a6964d4533c16f622f08b302a7f62c959b58f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482562
Reviewed-by: Chloe Stefantsova <cstefa...@google.com>
Commit-Queue: Paul Berry <paul...@google.com>


Commit: f7edf6a7f7fb6e45488ae2e0645579d25cc9e6dd
https://github.com/dart-lang/sdk/commit/f7edf6a7f7fb6e45488ae2e0645579d25cc9e6dd
Author: Paul Berry <paul...@google.com>
Date: 2026-02-23 (Mon, 23 Feb 2026)

Changed paths:
M pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_mini_ast.dart
M pkg/_fe_analyzer_shared/test/mini_ast.dart

Log Message:
-----------
[flow analysis] Remove _flowAnalysisInfoMap from mini_ast test harness.

Removes the `_flowAnalysisInfoMap` field from the `Harness` class,
which serves as the test harness for the mini_ast used in flow
analysis testing, along with the methods `getFlowAnalysisInfo` and
`storeFlowAnalysisInfo` that did map lookups. Calls to
`getFlowAnalysisInfo` are replaced with logic that pulls the flow
analysis expression info directly from the expression analysis result,
and calls to `storeFlowAnalysisInfo` are dropped (since they are no
longer needed).

Also, the assertion is dropped from `dispatchExpression` that used to
verify that the information stored in the map matched the information
stored in the expression analysis result.

Change-Id: I6a6a69643e0345a1f5ef84f09340119b56bfed12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482580
Reviewed-by: Chloe Stefantsova <cstefa...@google.com>
Commit-Queue: Paul Berry <paul...@google.com>


Commit: 62fc64513ceee73f891b9263a9d37bc1f51c463e
https://github.com/dart-lang/sdk/commit/62fc64513ceee73f891b9263a9d37bc1f51c463e
Author: Kallen Tu <kall...@google.com>
Date: 2026-02-23 (Mon, 23 Feb 2026)

Changed paths:
M pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
M pkg/analysis_server/lib/src/services/correction/fix_internal.dart
M pkg/analysis_server/test/src/services/correction/fix/remove_lexeme_test.dart

Log Message:
-----------
[analysis_server] Primary constructors - Add fix for var_with_no_type_annotation.

The fix for `var_with_no_type_annotation` is to remove the `var` keyword. We'll use the `RemoveLexeme` fix to accomplish this.

Bug: https://github.com/dart-lang/sdk/issues/61704
Change-Id: I0cd3951bdb78975c059ad2beaee4c77c68fabfda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482521
Commit-Queue: Kallen Tu <kall...@google.com>
Reviewed-by: Brian Wilkerson <brianwi...@google.com>


Commit: ba9923c406b32238c7ad36e1b9d0827d5c280acc
https://github.com/dart-lang/sdk/commit/ba9923c406b32238c7ad36e1b9d0827d5c280acc
Author: Konstantin Shcheglov <sche...@google.com>
Date: 2026-02-23 (Mon, 23 Feb 2026)

Changed paths:
M pkg/analyzer/lib/src/dart/resolver/scope_context.dart
M pkg/analyzer/lib/src/generated/resolver.dart

Log Message:
-----------
DeCo. Add ScopeContext.visitDocumentationComment

Centralize documentation comment traversal in ScopeContext so that all
declarations visit doc comments under a consistent
DocumentationCommentScope.

The new helper temporarily rebinds the doc-import scope’s inner scope to
the current name scope, assigns the comment’s nameScope, and then visits
the comment. This preserves correct resolution of identifiers referenced
from documentation comments while avoiding duplicated scope plumbing.

As part of the refactor:
- Remove per-call visitDocumentationComment overrides from ScopeContext’s
declaration visitors.
- Delete ScopeResolverVisitor’s private _visitDocumentationComment helper
and ScopeContext.withDocImportScope.
- Update all resolver call sites to route doc-comment visits through the
new ScopeContext API.

Change-Id: Iffbefb03cf5f61b61144a9f3a9cfc85b4df10491
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482981
Reviewed-by: Paul Berry <paul...@google.com>
Commit-Queue: Konstantin Shcheglov <sche...@google.com>


Commit: ea1bc24fdc6bf23b3a4ea2bc9a4e410a481b41dc
https://github.com/dart-lang/sdk/commit/ea1bc24fdc6bf23b3a4ea2bc9a4e410a481b41dc
Author: Robert Nystrom <rnys...@google.com>
Date: 2026-02-23 (Mon, 23 Feb 2026)

Changed paths:
M pkg/analysis_server/lib/src/services/correction/dart/convert_to_initializing_formal.dart
M pkg/analysis_server/test/src/services/correction/fix/convert_to_initializing_formal_test.dart

Log Message:
-----------
ConvertToInitializingFormal: Don't discard initializers when deleting the constructor body.

ConvertToInitializingFormal can convert an initializer to an initializing formal, or an assignment statement in the body:

```dart
class C {
int x;
C(int x) {
this.x = x;
}
}
```

When converting from an assignment statement, if there are no statements left in the block, it deletes the entire function body.

Prior to this CL, it would also erroneously delete any initializers that happened to be on the constructor:

```dart
// Before:
class C {
int? x;
int? y;

C(int? x) : y = 1 {
this.x = x;
}
}

// Result of applying fix:
class C {
int? x;
int? y;

C(this.x); // Oops! Where did ": y = 1" go?
}
```

Change-Id: I5bd27e925509adc82056b71f4c96432c819bc954
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482966
Reviewed-by: Samuel Rawlins <sraw...@google.com>
Commit-Queue: Samuel Rawlins <sraw...@google.com>
Auto-Submit: Bob Nystrom <rnys...@google.com>


Commit: 15c2666d934058820a9ea1cf8fad15eed74deeb3
https://github.com/dart-lang/sdk/commit/15c2666d934058820a9ea1cf8fad15eed74deeb3
Author: Dart CI <dart-inte...@dart-ci-internal.iam.gserviceaccount.com>
Date: 2026-02-23 (Mon, 23 Feb 2026)

Changed paths:
M pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_mini_ast.dart
M pkg/_fe_analyzer_shared/test/mini_ast.dart
M pkg/analysis_server/lib/src/services/correction/dart/convert_to_initializing_formal.dart
M pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
M pkg/analysis_server/lib/src/services/correction/fix_internal.dart
M pkg/analysis_server/test/src/services/correction/fix/convert_to_initializing_formal_test.dart
M pkg/analysis_server/test/src/services/correction/fix/remove_lexeme_test.dart
M pkg/analyzer/lib/src/dart/element/extensions.dart
M pkg/analyzer/lib/src/dart/element/scope.dart
M pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
M pkg/analyzer/lib/src/dart/resolver/scope_context.dart
M pkg/analyzer/lib/src/generated/resolver.dart
M pkg/analyzer/lib/src/summary2/reference_resolver.dart
M pkg/analyzer/test/src/dart/resolution/class_test.dart
M pkg/analyzer/test/src/dart/resolution/enum_test.dart
M tools/VERSION

Log Message:
-----------
Version 3.12.0-178.0.dev

Merge ea1bc24fdc6bf23b3a4ea2bc9a4e410a481b41dc into dev


Compare: https://github.com/dart-lang/sdk/compare/5c57e75f1102...15c2666d9340

copybara-service[bot]

unread,
Feb 23, 2026, 11:51:39 PM (8 hours ago) Feb 23
to com...@dartlang.org
Branch: refs/heads/lkgr-dev
Reply all
Reply to author
Forward
0 new messages