-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
devexp-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-positiveIssues related to lint rules that report a problem when it isn't a problem.Issues related to lint rules that report a problem when it isn't 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
It seems like invariant_booleans doesn't understand quite how switch statements work 🤔
To Reproduce
void test() {
final segments = [];
const label = 'hi';
switch (label) {
case 'hi':
if (segments.length != 2) return;
break;
case 'bye':
if (segments.length != 2) return; # invariant_booleans issue
break;
}
}This code generates this warning on the first statement under case 'bye':
Conditions should not unconditionally evaluate to `true` or to `false`. verify: segments.length != 2.
Expected behavior
This code should not violate the invariant_booleans rule.
lavinov-mercury
Metadata
Metadata
Assignees
Labels
devexp-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-positiveIssues related to lint rules that report a problem when it isn't a problem.Issues related to lint rules that report a problem when it isn't a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)