[dart-lang/sdk] d578bf: [DAS] Fixes `Replace 'final' with 'var'` for patte...

0 views
Skip to first unread message

Felipe Morschel

unread,
Jan 16, 2026, 2:27:14 PM (2 days ago) Jan 16
to com...@dartlang.org
Branch: refs/heads/main
Home: https://github.com/dart-lang/sdk
Commit: d578bf23cf076826cbe7297b018879fd787ac169
https://github.com/dart-lang/sdk/commit/d578bf23cf076826cbe7297b018879fd787ac169
Author: FMorschel <g...@fmorschel.dev>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.dart
M pkg/analysis_server/test/src/services/correction/fix/replace_final_with_var_test.dart

Log Message:
-----------
[DAS] Fixes `Replace 'final' with 'var'` for pattern variable declaration

Fixes: https://github.com/dart-lang/sdk/issues/62311
Change-Id: Ibfde23b6dadede8c65b0f7d90cff3edb57c76339
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472940
Reviewed-by: Brian Wilkerson <brianwi...@google.com>
Commit-Queue: Brian Wilkerson <brianwi...@google.com>
Auto-Submit: Felipe Morschel <g...@fmorschel.dev>
Reviewed-by: Samuel Rawlins <sraw...@google.com>



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

Felipe Morschel

unread,
Jan 16, 2026, 3:20:36 PM (2 days ago) Jan 16
to com...@dartlang.org
Branch: refs/heads/lkgr
Home: https://github.com/dart-lang/sdk
Commit: d578bf23cf076826cbe7297b018879fd787ac169
https://github.com/dart-lang/sdk/commit/d578bf23cf076826cbe7297b018879fd787ac169
Author: FMorschel <g...@fmorschel.dev>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.dart
M pkg/analysis_server/test/src/services/correction/fix/replace_final_with_var_test.dart

Log Message:
-----------
[DAS] Fixes `Replace 'final' with 'var'` for pattern variable declaration

Fixes: https://github.com/dart-lang/sdk/issues/62311
Change-Id: Ibfde23b6dadede8c65b0f7d90cff3edb57c76339
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472940
Reviewed-by: Brian Wilkerson <brianwi...@google.com>
Commit-Queue: Brian Wilkerson <brianwi...@google.com>
Auto-Submit: Felipe Morschel <g...@fmorschel.dev>
Reviewed-by: Samuel Rawlins <sraw...@google.com>


Commit: b9a2d281c208e1d7b424b4148d6c8a456ce2e25d
https://github.com/dart-lang/sdk/commit/b9a2d281c208e1d7b424b4148d6c8a456ce2e25d
Author: FMorschel <g...@fmorschel.dev>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analysis_server/lib/src/services/correction/dart/add_missing_switch_cases.dart
M pkg/analysis_server/test/src/services/correction/fix/add_missing_switch_cases_test.dart

Log Message:
-----------
[DAS] Fixes `Add missing switch cases` fix

Fixes: https://github.com/dart-lang/sdk/issues/62426
Change-Id: Ida130b53037f9a704fea8089e70c15edce0fe554
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473700
Auto-Submit: Felipe Morschel <g...@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwi...@google.com>
Reviewed-by: Samuel Rawlins <sraw...@google.com>
Commit-Queue: Brian Wilkerson <brianwi...@google.com>


Compare: https://github.com/dart-lang/sdk/compare/0a421ad4091a...b9a2d281c208

copybara-service[bot]

unread,
Jan 16, 2026, 7:10:43 PM (2 days ago) Jan 16
to com...@dartlang.org
Branch: refs/heads/dev
Commit: 6d37c621111b726650b9d2ffd9c052779681ed01
https://github.com/dart-lang/sdk/commit/6d37c621111b726650b9d2ffd9c052779681ed01
Author: FMorschel <g...@fmorschel.dev>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
A pkg/analysis_server/lib/src/services/correction/dart/replace_with_is.dart
M pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
M pkg/analysis_server/lib/src/services/correction/fix.dart
M pkg/analysis_server/lib/src/services/correction/fix_internal.dart
A pkg/analysis_server/test/src/services/correction/fix/replace_with_is_test.dart
M pkg/analysis_server/test/src/services/correction/fix/test_all.dart

Log Message:
-----------
[DAS] Adds fix for `unrelated_type_equality_checks` and type literals

Fixes: https://github.com/dart-lang/sdk/issues/62388
Change-Id: Ic4b77686ce8c45b274d05f78de03da9d797879ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472941
Reviewed-by: Samuel Rawlins <sraw...@google.com>
Commit-Queue: Brian Wilkerson <brianwi...@google.com>
Reviewed-by: Brian Wilkerson <brianwi...@google.com>
Auto-Submit: Felipe Morschel <g...@fmorschel.dev>


Commit: bfe325b834b3166c07f1e136b6fdeb226e120eae
https://github.com/dart-lang/sdk/commit/bfe325b834b3166c07f1e136b6fdeb226e120eae
Author: Robert Nystrom <rnys...@google.com>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analysis_server/lib/src/services/correction/dart/add_field_formal_parameters.dart
M pkg/analysis_server/test/src/services/correction/fix/add_field_formal_parameters_test.dart

Log Message:
-----------
Update AddFieldFormalParameters to handle private named parameters.

With this CL, if you add required named parameters for private fields, it will use private named parameters:

```dart
// Before:
class C {
final int _foo;
}

// After:
class C {
final int _foo;
C({required this._foo});
}
```

Prior to this CL, it would have instead produced:

```dart
// After:
class C {
final int _foo;
C({required int foo}) : _foo = foo;
}
```

It will only do this if private named parameters are enabled and the field has a valid corresponding public name:

```dart
// Before:
class C {
final int _ok;
final int _123;
final int _for;
}

// After:
class C {
final int _ok;
final int _123;
final int _for;
C({required this.ok, required int p123, required int pfor})
: _123 = p123,
_for = pfor;
}
```

There is one other behavioral change in the CL. It will now also use initializing formals when adding positional parameters for private fields:

```dart
// Before:
class C {
final int _foo;
}

// After:
class C {
final int _foo;
C(this._foo);
}
```

Since private named parameters means that users will start seeing private initializing formals, it seemed pointless to me to avoid them for positional parameters. Also, doing this avoids a bug that the current implementation has. Before this CL, when adding positional parameters for private fields, it doesn't check that resulting parameter name isn't reserved:

```dart
// Before:
class C {
final int _class;
}

// After:
class C {
final int _class;
C(int class) : _class = class;
// ^^^^^ Oops!
}
```

With this CL, it will simply do:

```
// After:
class C {
final int _class;
C(this._class);
}
```

(It does correctly handle a private *named* parameter whose corresponding public name is a reserved word.)

BUG: https://github.com/dart-lang/sdk/issues/62430

Change-Id: I300066e7df0eb93b3674eac56bd48cdcdfa95758
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473782
Auto-Submit: Bob Nystrom <rnys...@google.com>
Reviewed-by: Brian Wilkerson <brianwi...@google.com>
Commit-Queue: Bob Nystrom <rnys...@google.com>
Reviewed-by: Konstantin Shcheglov <sche...@google.com>


Commit: 026bb7cfeb2599fc37fa5a82714db25e6a7a4f28
https://github.com/dart-lang/sdk/commit/026bb7cfeb2599fc37fa5a82714db25e6a7a4f28
Author: Alexander Aprelev <a...@google.com>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M tests/standalone/io/regress_flutter_57125_test.dart

Log Message:
-----------
[vm/gardening] Handle child process racing to exit.

Writing to stdin of already exited child process might not raise an error, will cause infinite loop in the test.

Fixes https://github.com/dart-lang/sdk/issues/56400
TEST=ci

Change-Id: I0100b5e5d782ae3682d634a47759b78146243274
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473821
Reviewed-by: Alexander Markov <alexm...@google.com>
Commit-Queue: Alexander Aprelev <a...@google.com>


Commit: 05ba29991e19e7d6fa15c94d7cc782493052de5d
https://github.com/dart-lang/sdk/commit/05ba29991e19e7d6fa15c94d7cc782493052de5d
Author: Paul Berry <paul...@google.com>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analyzer/lib/src/dart/scanner/scanner.dart

Log Message:
-----------
[messages] Fix signature of Scanner.reportError.

Changes the signature of `Scanner.reportError` so that its `arguments`
parameter requires a `List<Object>?` rather than a
`List<Object?>?`. This is consistent with the call sites.

This paves the way for a follow-up CL that will change
`Scanner.reportError` to use the literate diagnostic API (which
requires arguments to never be `null`).

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


Commit: 61b86b94838afe104d4ceb79644aa046d7889f9f
https://github.com/dart-lang/sdk/commit/61b86b94838afe104d4ceb79644aa046d7889f9f
Author: Paul Berry <paul...@google.com>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analyzer/lib/src/diagnostic/diagnostic.g.dart
M pkg/analyzer/lib/src/manifest/manifest_validator.dart
M pkg/analyzer/messages.yaml

Log Message:
-----------
[messages] Use literate API in _reportErrorForNode.

Changes `ManifestValidator._reportErrorForNode` to use the literate
diagnostic reporting API.

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


Commit: cf1d8b96dba77f42ae5941d195c245d7c322809c
https://github.com/dart-lang/sdk/commit/cf1d8b96dba77f42ae5941d195c245d7c322809c
Author: Paul Berry <paul...@google.com>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analysis_server/lib/src/g3/utilities.dart
M pkg/analysis_server/lib/src/lsp/source_edits.dart
M pkg/analysis_server/lib/src/services/correction/statement_analyzer.dart
M pkg/analysis_server/test/stress/replay/replay.dart
M pkg/analysis_server_plugin/lib/edit/correction_utils.dart
M pkg/analyzer/lib/dart/analysis/utilities.dart
M pkg/analyzer/lib/src/dart/analysis/file_state.dart
M pkg/analyzer/lib/src/dart/scanner/scanner.dart
M pkg/analyzer/lib/src/generated/parser.dart
M pkg/analyzer/test/generated/parser_test_base.dart
M pkg/analyzer/test/generated/scanner_test.dart
M pkg/analyzer/test/src/dart/ast/parse_base.dart
M pkg/analyzer/test/src/summary/test_strategies.dart
M pkg/analyzer_cli/tool/perf.dart
M pkg/front_end/tool/perf.dart
M pkg/scrape/lib/scrape.dart

Log Message:
-----------
[messages] Make Scanner and Parser take a DiagnosticReporter.

Changes the signature of the following constructors:
- Scanner
- Scanner.fasta
- Parser

So that they accept a `DiagnosticReporter` object rather than a
`DiagnosticListener` object. This brings the scanner and the parser
into alignment with the majority of the rest of the analyzer (which
reports errors using `DiagnosticReporter` rather than by talking to
`DiagnosticListener` directly).

It also makes the `source` parameter of these constructors
unnecessary, because the `source` can be obtained from the
`DiagnosticReporter`.

Change-Id: I6a6a6964607ffb52a8332a6e618dc0c9a1e48c5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473442
Reviewed-by: Brian Wilkerson <brianwi...@google.com>
Reviewed-by: Bob Nystrom <rnys...@google.com>
Reviewed-by: Konstantin Shcheglov <sche...@google.com>
Commit-Queue: Paul Berry <paul...@google.com>


Commit: 00fec6da9fc355bdb2196e7e8dc29290c28b68f9
https://github.com/dart-lang/sdk/commit/00fec6da9fc355bdb2196e7e8dc29290c28b68f9
Author: Sam Rawlins <sraw...@google.com>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analyzer/lib/src/dart/ast/ast.dart
M pkg/analyzer/lib/src/lint/constants.dart
M pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart
M pkg/linter/test/rules/prefer_const_constructors_in_immutables_test.dart

Log Message:
-----------
linter: prefer_const_constructors_in_immutables support for Primary Constructors

Fixes https://github.com/dart-lang/sdk/issues/61991

* I made the `constKeyword` field non-final in order to support the
`canBeConst` utility.
* I refactored how the rule worked with extension types, since it
already sort of worked with those primary constructors.
* Unfortunately, PrimaryConstructorDeclaration and
ConstructorDeclaration are different enough that I mostly doubled the
implementation of both the `canBeConst` utility, and the visit
methods in the lint rule.
* I moved `hasImmutableAnnotation` to be an extension getter.
* I moved the error location to be the open parenthesis of an unnamed
primary constructor, which changes one existing test expectation, from
`E` to `(`. This is more correct, I believe.

Change-Id: I999885a44e27bef45fbd3dc064eb0de043d9dae0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473541
Reviewed-by: Brian Wilkerson <brianwi...@google.com>
Reviewed-by: Konstantin Shcheglov <sche...@google.com>
Commit-Queue: Samuel Rawlins <sraw...@google.com>


Commit: 728f837e1872dfae0f1e200e59681db75702a5f4
https://github.com/dart-lang/sdk/commit/728f837e1872dfae0f1e200e59681db75702a5f4
Author: Paul Berry <paul...@google.com>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analyzer/lib/src/dart/scanner/scanner.dart
M pkg/analyzer/lib/src/dart/scanner/translate_error_token.dart
M pkg/analyzer/lib/src/diagnostic/diagnostic.g.dart
M pkg/analyzer/lib/src/fasta/error_converter.dart
M pkg/analyzer/messages.yaml
M pkg/front_end/test/scanner_cfe_test.dart
M pkg/front_end/test/scanner_replacement_test.dart
M pkg/front_end/test/scanner_test.dart

Log Message:
-----------
[messages] Use literate API for scanner error reporting.

Changes the error reporting logic in the `Scanner` class to use the
literate diagnostic reporting API, along with the top level function
`translateErrorToken`, which `Scanner` makes use of.

This required changing the signature of the `ReportError` typedef,
which is used to communicate scanner errors to front end unit tests.

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


Commit: 62061c199c7f0a44df6cbdd7bd0698975d02c378
https://github.com/dart-lang/sdk/commit/62061c199c7f0a44df6cbdd7bd0698975d02c378
Author: Konstantin Shcheglov <sche...@google.com>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analyzer/lib/src/dart/analysis/driver.dart
M pkg/analyzer/lib/src/dart/element/element.dart
M pkg/analyzer/test/dart/sdk/build_sdk_summary_test.dart

Log Message:
-----------
Issue 62422. Work around not existing file in Flutter SDK.

I plan to release 'analyzer 10.0.1' with this change cherry-picked into
the branch with 'analyzer 10.0.0'.

Bug: https://github.com/dart-lang/sdk/issues/62422
Change-Id: I3d48a064820a164b94ca19f6fa94b44aaa6581d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473841
Reviewed-by: Paul Berry <paul...@google.com>
Commit-Queue: Konstantin Shcheglov <sche...@google.com>


Commit: 65346915b25d793cb64eb0c0f6497621cf185bb1
https://github.com/dart-lang/sdk/commit/65346915b25d793cb64eb0c0f6497621cf185bb1
Author: Dart CI <dart-inte...@dart-ci-internal.iam.gserviceaccount.com>
Date: 2026-01-16 (Fri, 16 Jan 2026)

Changed paths:
M pkg/analysis_server/lib/src/g3/utilities.dart
M pkg/analysis_server/lib/src/lsp/source_edits.dart
M pkg/analysis_server/lib/src/services/correction/dart/add_field_formal_parameters.dart
M pkg/analysis_server/lib/src/services/correction/dart/add_missing_switch_cases.dart
M pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.dart
A pkg/analysis_server/lib/src/services/correction/dart/replace_with_is.dart
M pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
M pkg/analysis_server/lib/src/services/correction/fix.dart
M pkg/analysis_server/lib/src/services/correction/fix_internal.dart
M pkg/analysis_server/lib/src/services/correction/statement_analyzer.dart
M pkg/analysis_server/test/src/services/correction/fix/add_field_formal_parameters_test.dart
M pkg/analysis_server/test/src/services/correction/fix/add_missing_switch_cases_test.dart
M pkg/analysis_server/test/src/services/correction/fix/replace_final_with_var_test.dart
A pkg/analysis_server/test/src/services/correction/fix/replace_with_is_test.dart
M pkg/analysis_server/test/src/services/correction/fix/test_all.dart
M pkg/analysis_server/test/stress/replay/replay.dart
M pkg/analysis_server_plugin/lib/edit/correction_utils.dart
M pkg/analyzer/lib/dart/analysis/utilities.dart
M pkg/analyzer/lib/src/dart/analysis/driver.dart
M pkg/analyzer/lib/src/dart/analysis/file_state.dart
M pkg/analyzer/lib/src/dart/ast/ast.dart
M pkg/analyzer/lib/src/dart/element/element.dart
M pkg/analyzer/lib/src/dart/scanner/scanner.dart
M pkg/analyzer/lib/src/dart/scanner/translate_error_token.dart
M pkg/analyzer/lib/src/diagnostic/diagnostic.g.dart
M pkg/analyzer/lib/src/fasta/error_converter.dart
M pkg/analyzer/lib/src/generated/parser.dart
M pkg/analyzer/lib/src/lint/constants.dart
M pkg/analyzer/lib/src/manifest/manifest_validator.dart
M pkg/analyzer/messages.yaml
M pkg/analyzer/test/dart/sdk/build_sdk_summary_test.dart
M pkg/analyzer/test/generated/parser_test_base.dart
M pkg/analyzer/test/generated/scanner_test.dart
M pkg/analyzer/test/src/dart/ast/parse_base.dart
M pkg/analyzer/test/src/summary/test_strategies.dart
M pkg/analyzer_cli/tool/perf.dart
M pkg/front_end/test/scanner_cfe_test.dart
M pkg/front_end/test/scanner_replacement_test.dart
M pkg/front_end/test/scanner_test.dart
M pkg/front_end/tool/perf.dart
M pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart
M pkg/linter/test/rules/prefer_const_constructors_in_immutables_test.dart
M pkg/scrape/lib/scrape.dart
M tests/standalone/io/regress_flutter_57125_test.dart
M tools/VERSION

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

Merge 62061c199c7f0a44df6cbdd7bd0698975d02c378 into dev


Compare: https://github.com/dart-lang/sdk/compare/973c3ec40791...65346915b25d

copybara-service[bot]

unread,
Jan 16, 2026, 7:43:36 PM (2 days ago) Jan 16
to com...@dartlang.org
Branch: refs/heads/lkgr-dev
Reply all
Reply to author
Forward
0 new messages