Add @redeclare

See: https://github.com/dart-lang/sdk/issues/53121

Change-Id: I812bc49b58cdf15e9c0c8bcc62a846b51f5dff70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319100
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
pq 2023-08-09 16:59:00 +00:00 committed by Commit Queue
parent 061396f38d
commit 98070ec188

View file

@ -268,6 +268,18 @@ const _OptionalTypeArgs optionalTypeArgs = _OptionalTypeArgs();
// "referenced."
const _Protected protected = _Protected();
/// Used to annotate an instance member of an extension type that
/// redeclares a member from a superinterface.
///
/// Tools, such as the analyzer, can provide feedback if
///
/// * the annotation is associated with anything other than a valid instance
/// member of an extension type (a method, operator, getter, or setter) or
/// * is applied to a member that does not redeclare a member from either the
/// extended type or a superinterface.
@experimental
const _Redeclare redeclare = _Redeclare();
/// Annotation for intentionally loosening restrictions on subtyping that would
/// otherwise cause lint warnings to be produced by the `implicit_reopen` lint.
///
@ -519,6 +531,16 @@ class _Protected {
const _Protected();
}
@Target({
// todo(pq): restrict to instance members only
TargetKind.getter,
TargetKind.setter,
TargetKind.method,
})
class _Redeclare {
const _Redeclare();
}
@Target({
TargetKind.classType,
TargetKind.mixinType,