Skip to content

Incorrect cascade_invocations lint #57855

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

Incorrect cascade_invocations lint #57855

ghost opened this issue Dec 21, 2018 · 0 comments
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

@ghost
Copy link

ghost commented Dec 21, 2018

@zanderso commented on Dec 20, 2018, 11:41 PM UTC:

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.

This issue was moved by stereotype441 from dart-lang/sdk#35469.

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

3 participants