-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.customer-flutterdevexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.Issues related to lint rules that report a problem when it isn't a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
@Hixie commented on Mar 4, 2018, 10:53 AM UTC:
Enable the cascade_invocations lint, then analyze this:
class A { }
class B extends A { void foo() { } }
void test(A x) {
if (A is B) {
final B b = x;
b.foo();
}
}
void main() { }
It says: lint • Cascade consecutive method invocations on the same reference at test.dart:7:5 • cascade_invocations
However, if you change it as suggested:
class A { }
class B extends A { void foo() { } }
void test(A x) {
if (A is B) {
final B b = x
..foo();
}
}
void main() { }
...then now the code is no longer correct (error • The method 'foo' isn't defined for the class 'A' at test.dart:7:9 • undefined_method
).
This issue was moved by pq from dart-lang/sdk#32407.
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.customer-flutterdevexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.Issues related to lint rules that report a problem when it isn't a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)