-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.Issues related to lint rules that report a problem when it isn't a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
It seems that with Dart 3.7, we're getting a lint error saying that our inverse operator overrides an inherited member. Fine, annotate with @override even though we have not defined it in our inherited type. However, once that is added it complains that it doesn't override anything. Which is true. The issue resolves if we add the operator to our super type but that causes a whole set of other problems for us.
The expectation is that we shouldn't have to annotate this operator since it isn't implemented in the super type.
Maybe we're doing something funny but this has been fine for us for years up until this release.
abstract class Foo {
const Foo(this.value);
final int value;
Foo operator -(Foo other);
}
class Bar extends Foo {
const Bar(super.value);
@override
Bar operator -(Foo other) {
return Bar(value - other.value);
}
Bar operator -() {
return Bar(-value);
}
}Steps to reproduce:
dart create -t package inverse_operatorwith the defaultlintpackage and options.- Drop the above code into
lib/ dart analyzewith 3.6 and 3.7.
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.Issues related to lint rules that report a problem when it isn't a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)