[dart-lang/sdk] 4c2ffa: analyzer: Fix missing `deprecated_member_use`

0 views
Skip to first unread message

Kevin Moore

unread,
Apr 28, 2026, 10:42:03 AM (yesterday) Apr 28
to com...@dartlang.org
Branch: refs/heads/main
Home: https://github.com/dart-lang/sdk
Commit: 4c2ffad5caf1df537228992d5e81f3f6e92e6119
https://github.com/dart-lang/sdk/commit/4c2ffad5caf1df537228992d5e81f3f6e92e6119
Author: kevmoo <kev...@google.com>
Date: 2026-04-28 (Tue, 28 Apr 2026)

Changed paths:
M pkg/analyzer/lib/src/error/best_practices_verifier.dart
M pkg/analyzer/lib/src/error/element_usage_detector.dart
M pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart

Log Message:
-----------
analyzer: Fix missing `deprecated_member_use`

...on named parameters in annotations

The analyzer failed to report `deprecated_member_use` when using a deprecated named parameter in a constant constructor invocation used as an annotation (e.g., `@JsonKey(ignore: true)`).

This was because `ElementUsageDetector` lacked an `annotation` method to process arguments, and `BestPracticesVerifier` did not call it. This issue is similar to the one fixed for unused parameters in annotations in commit d8cfa31e03b.

This commit:
- Adds an `annotation` method to `ElementUsageDetector` to check arguments against parameters.
- Calls this method from `BestPracticesVerifier.visitAnnotation`.
- Adds a reproduction test in `pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart`.

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

Change-Id: I9e452ecad19c9cd6b0e5170233a313114e4d7c59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498480
Commit-Queue: Kevin Moore <kev...@google.com>
Reviewed-by: Konstantin Shcheglov <sche...@google.com>
Auto-Submit: Kevin Moore <kev...@google.com>



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

Kevin Moore

unread,
Apr 28, 2026, 11:51:07 AM (yesterday) Apr 28
to com...@dartlang.org
Branch: refs/heads/lkgr
Reply all
Reply to author
Forward
0 new messages