Skip to content

unrelated_type_equality_checks doesn't trigger on sibling types #58090

Open
@sigurdm

Description

@sigurdm

Either the description is off, or the lint. Not sure which.

Reading the documentation for #unrelated_type_equality_checks says:

Comparing references of a type where neither is a subtype of the other most likely will return false and might not reflect programmer's intent.

If we have a simplified version of the protobufEnum world:

class C {}

class A extends C {}

class B extends C {}

main() {
  print(A() == B());
}

Then A is not a subtype of B nor is B a subtype of A, and from the description it seems I would get a lint, but when I try it I don't.

If sibling types where considered unrelated it would be useful for prottobuf enums, they should never be compared between different enum types, as the answer is always false, even if the underlying value is the same.

Related to internal issue: b/146122892

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A 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.devexp-linterIssues with the analyzer's support for the linter packagelinter-false-negativelinter-set-coretype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions