Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Fix cascade_invocations false positive when examining complicated expressions #1328

Merged
merged 2 commits into from
Dec 27, 2018

Conversation

srawlins
Copy link
Contributor

Fixes dart-lang/sdk#57855

The lint rule uses getCanonicalElementFromIdentifier to see if two statements act on the same element, in order to report that they can be combined with a cascade. But unless the expressions are simple, up to a point, the rule cannot know that one statement acts on b1.a and the second acts on b2.a, even though both act on A get a.

int f;
int g;

void x() {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't seem to be using these methods. If so, remove them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Good catch.

@alexeieleusis
Copy link
Contributor

Thanks for the PR, quite a contrived use case!

@srawlins srawlins merged commit 1e603e1 into dart-archive:master Dec 27, 2018
@srawlins srawlins deleted the cascade-bug-1323 branch December 27, 2018 20:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

3 participants