Skip to content

[unrelated_type_equality_checks] Missing report for unrelated extension types #59373

Description

@Levi-Lesches

Describe the issue
The lint fails to appear when comparing two (unrelated) extension types

To Reproduce

extension type UserID(int id) { }
extension type ProfileID(String id) { }

void main() {
  final a = 1;
  final b = UserID(1);
  final c = ProfileID("Hello");
  print(a == b);  // unrelated
  print(b == c);  // <-- no lint?
  print(a == c);  // unrelated
}

This also happens in the subtler case when ProfileID is an extension on int as well:

extension type UserID(int id) { }
extension type ProfileID(int id) { }

void main() {
  final a = 1;
  final b = UserID(1);
  final c = ProfileID(1);
  print(a == b);  // unrelated
  print(b == c);  // <-- no lint?
  print(a == c);  // unrelated
}

Expected behavior
I would expect comparing b == c would show a lint, just like a == b and a == c does.

Metadata

Metadata

Assignees

Labels

P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagelinter-false-negativeIssues related to lint rules that fail to report a problem.linter-set-coretype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions