Skip to content

Linter allows compare different enums #58653

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
westito opened this issue Feb 5, 2022 · 1 comment
Closed

Linter allows compare different enums #58653

westito opened this issue Feb 5, 2022 · 1 comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-false-negative P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@westito
Copy link

westito commented Feb 5, 2022

Describe the issue
Linter allows comparing different enums, despite unrelated_type_equality_checks enabled

To Reproduce

enum FilterGroupBy { date, competitions }
enum FilterMatchSelection { allMatches, onlyFavorites }

FilterGroupBy groupBy = FilterGroupBy.date;
FilterMatchSelection matchSelection = FilterMatchSelection.allMatches;

// No linter error
if (groupBy == FilterMatchSelection.onlyFavorites) {
}

// Comparing variables allowed either
if (groupBy == matchSelection) {
}

// Linter: Equality operator `==` invocation with references of unrelated types.
if (groupBy == 0) {
}

Expected behavior
Linter shows unrelated types error

Version
Dart SDK version: 2.16.0 (stable) (Mon Jan 31 15:28:59 2022 +0100) on "macos_x64"

@srawlins srawlins added linter-false-negative type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Aug 10, 2022
@srawlins srawlins added the P3 A lower priority bug or feature request label Oct 25, 2022
@srawlins
Copy link
Member

Fixed with dart-archive/linter#4282

@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-false-negative P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants