-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Another bogus "Conditions should not unconditionally evaluate to "TRUE" or to "FALSE"" warning. #28967
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
Comments
@ktullavik |
These cases are indeed not considered in the rule, there is a bug reported for it and a PR out dart-archive/linter#412 should land soon. |
By the way, the rule does not try to infer the value of the variable, and should not warn about anything inside the outer |
@mraleph the warning is not dependant on the value of b. |
@ktullavik no matter which constant value you select for the initial value of Compare your example with void test(bool x) {
int b = x ? 2 : 1;
if (b > 0) {
b--;
if (b == 0) {
return;
}
if (b > 0) {
return;
}
}
} Here indeed conditions are not constant. |
@mraleph |
This linter rule is removed. |
When changing a variable with unary operators, the analyser don't seem to invalidate its
assumptions - and produces false warnings.
Example, both inner conditionals in this function give bogus warnings:
Funny enough, the warning would be appropriate for the outer conditional.
Dart SDK version: 1.22.1
The text was updated successfully, but these errors were encountered: