Skip to content
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

False positive in invariant_booleans #57601

Closed
lexaknyazev opened this issue Jun 27, 2017 · 3 comments
Closed

False positive in invariant_booleans #57601

lexaknyazev opened this issue Jun 27, 2017 · 3 comments
Assignees
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-false-positive P4 type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@lexaknyazev
Copy link
Contributor

Dart SDK 1.25.0-dev.3.0

void main() {
  var a = 0;
  var index = 0;
  var length = 5;
  switch(a) {
    case 0:
      while(index < length) {
        ++index;
      }
      break;
    case 1:
      while(index < length) { // <--------
        ++index;
      }
      break;
  }
}

gives (line 12):

info: Conditions should not unconditionally evaluate to "TRUE" or to "FALSE" verify: index < length. 
@alexeieleusis alexeieleusis self-assigned this Jun 27, 2017
@alexeieleusis
Copy link
Contributor

My guess is that the while statement in case 0: makes it trigger on case 1. Will look into this later, unless there is already a PR for it.

@pq pq added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Jun 28, 2017
@kevmoo
Copy link
Member

kevmoo commented Oct 12, 2017

Just hit this with stageXL on 2.0.0-dev.3.0

@srawlins
Copy link
Member

We've deprecated invariant_booleans and will not be fixing correctness bugs going forward.

@devoncarew devoncarew added analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-lang/linter Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-false-positive P4 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.

6 participants