Skip to content

Bogus "Conditions should not unconditionally evaluate to "TRUE" or to "FALSE"" warning #28262

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

Closed
Hixie opened this issue Jan 5, 2017 · 2 comments
Assignees
Labels
closed-obsolete Closed as the reported issue is no longer relevant devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@Hixie
Copy link
Contributor

Hixie commented Jan 5, 2017

This code:

enum Enum { a, b }

String test(Enum x, String s) {
  switch (x) {
    case Enum.a:
      if (s != null)
        return 'a';
      return 'b';
    case Enum.b:
      if (s != null)
        return 'c';
      return 'd';
  }
  return null;
}

void main() {
  print(test(Enum.a, ''));
}

This .analysis_options file:

linter:
  rules:
    - invariant_booleans

...results in this error:

$ dartanalyzer test.dart
Analyzing [test.dart]...
[lint] Conditions should not unconditionally evaluate to "TRUE" or to "FALSE" verify: s != null. (test.dart, line 11, col 11)
1 lint found.
@mit-mit mit-mit added the legacy-area-analyzer Use area-devexp instead. label Jan 5, 2017
@bwilkerson bwilkerson added devexp-linter Issues with the analyzer's support for the linter package P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jan 5, 2017
@bwilkerson
Copy link
Member

@alexeieleusis

@natebosch
Copy link
Member

This example no longer repros for me.

@natebosch natebosch added the closed-obsolete Closed as the reported issue is no longer relevant label Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-obsolete Closed as the reported issue is no longer relevant devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants