For unrelated_type_equality_checks (and other rules), how are extension types related to other things? #59299
Labels
area-devexp
For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.
devexp-linter
Issues with the analyzer's support for the linter package
linter-new-language-feature
linter-set-core
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
Here's a very simple example:
An
ET
can be equal to anint?
, and vice versa. AnETnum
can be equal to aint?
, and vice versa. It seems like they should be considered "related."Similarly an extension type should be considered "related" to other extension types that it "implements."
One other big lint rule that this affects is
collection_methods_unrelated_type
:Should all of the code here be allowed? I think so...
So more formally, given a type T and an extension type V1 declared as
extension type V1(T it) implements V2, V3, ...
:But there might be something more necessary, like "V1 is related to any type which T is related to." Then if V1 is an extension type on int, it is related to num.
I'll note that the algorithm for "relatedness" is not super well-defined, and is pretty ad hoc, but these are important linter rules, and the existing relatedness algorithm has gotten us very far.
CC @pq @jacob314 @eernstg @lrhn
The text was updated successfully, but these errors were encountered: