Skip to content

Incorrect cascade_invocations lint #35469

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
zanderso opened this issue Dec 20, 2018 · 1 comment
Closed

Incorrect cascade_invocations lint #35469

zanderso opened this issue Dec 20, 2018 · 1 comment
Labels
customer-fuchsia devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@zanderso
Copy link
Member

The analyzer cascade_invocations lint asks for cascading across different references:

test.dart:

class A {
  int f;
  int g;
}

class B {
  final A a = A();
}

void main() {
  final B b1 = B();
  final B b2 = B();

  b1.a
    ..f = 1
    ..g = 1;
  b2.a.f = 2;
}

With analysis_options.yaml:

linter:
  rules:
    - cascade_invocations

Gives

$ dartanalyzer ../cascade_bug_test.dart 
Analyzing ../cascade_bug_test.dart...
  lint • Cascade consecutive method invocations on the same reference at /usr/local/google/home/zra/dart/cascade_bug_test.dart:17:3 • cascade_invocations
1 lint found.

Where line 17 is b2.a.f = 2; where b2 is a different reference and can't be cascaded with the b1.a cascade.

@zanderso zanderso added legacy-area-analyzer Use area-devexp instead. devexp-linter Issues with the analyzer's support for the linter package type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) customer-fuchsia labels Dec 20, 2018
@ghost ghost deleted a comment from stereotype441 Dec 21, 2018
@ghost
Copy link

ghost commented Dec 21, 2018

This issue was moved by stereotype441 to dart-lang/linter#1323.

@ghost ghost closed this as completed Dec 21, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-fuchsia devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

1 participant