Skip to content

unrelated_type_equality_checks does not lint enums #59004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ltOgt opened this issue Jan 19, 2023 · 1 comment
Closed

unrelated_type_equality_checks does not lint enums #59004

ltOgt opened this issue Jan 19, 2023 · 1 comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-set-core

Comments

@ltOgt
Copy link

ltOgt commented Jan 19, 2023

Describe the issue

The unrelated_type_equality_checks lint does not lint comparing unrelated enums.

To Reproduce

With analysis_options.yaml

linter:
  rules:
    - unrelated_type_equality_checks

And main.dart

enum Enum1 {
  one,
}

enum Enum2 {
  two,
}

class A {}

class B {}

void main(List<String> args) {
  A() == B(); // Equality operator `==` invocation with references of unrelated types. dart(unrelated_type_equality_checks)
  A() != B(); // Equality operator `==` invocation with references of unrelated types. dart(unrelated_type_equality_checks)
  Enum1.one == Enum2.two; // No lint
  Enum1.one != Enum2.two; // No lint
}

Expected behavior

Comparing enums of unrelated types should be linted by the unrelated_type_equality_checks lint.

Additional context

$ dart --version
Dart SDK version: 2.18.6 (stable) (Tue Dec 13 21:15:14 2022 +0000) on "macos_arm64"
@srawlins
Copy link
Member

Thanks for filing an issue. Duplicate of #58653.

@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 19, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-set-core
Projects
None yet
Development

No branches or pull requests

3 participants