Skip to content

prefer_conditional_assignment false positive on complex statements #57859

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
srawlins opened this issue Dec 27, 2018 · 0 comments
Closed

prefer_conditional_assignment false positive on complex statements #57859

srawlins opened this issue Dec 27, 2018 · 0 comments
Assignees
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-false-positive type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@srawlins
Copy link
Member

Take the following code:

class Person {
  A a;
  A b;

  void f() {
    if (a.i == null) {
      // LINT
      b.i = 7;
    }
  }
}

class A {
  int i;
}

This code reports an error at the LINT line, "Prefer using ??= over testing for null," because it does not take into account that a.i is not equal to b.i.

(Same cause as #57855 and #57858)

@srawlins srawlins self-assigned this Dec 27, 2018
@srawlins srawlins added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) linter-false-positive labels Dec 27, 2018
@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-false-positive type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants