Skip to content

Another bogus "Conditions should not unconditionally evaluate to "TRUE" or to "FALSE"" warning. #28967

@ktullavik

Description

@ktullavik

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:

    void test() {
        int b = 2;
        if (b > 0) {
            b--;
            if (b == 0) {
                return;
            }
            if (b > 0) {
              return;
            }
        }
    }

Funny enough, the warning would be appropriate for the outer conditional.
Dart SDK version: 1.22.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work ondevexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions