[dart-lang/sdk] 00fec6: linter: prefer_const_constructors_in_immutables su...

0 views
Skip to first unread message

Sam Rawlins

unread,
Jan 16, 2026, 4:54:53 PM (2 days ago) Jan 16
to com...@dartlang.org
Branch: refs/heads/main
Home: https://github.com/dart-lang/sdk
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>



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

Konstantin Scheglov

unread,
Jan 16, 2026, 6:16:19 PM (2 days ago) Jan 16
to com...@dartlang.org
Branch: refs/heads/lkgr
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>


Compare: https://github.com/dart-lang/sdk/compare/cf1d8b96dba7...62061c199c7f
Reply all
Reply to author
Forward
0 new messages