-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestdevexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.linter-false-negativeIssues related to lint rules that fail to report a problem.Issues related to lint rules that fail to report a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
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"
minhqdao, ltOgt, jagmit and MichaelTamm
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestdevexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.linter-false-negativeIssues related to lint rules that fail to report a problem.Issues related to lint rules that fail to report a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)