linter: Fix false positive in cascade_invocations wrt const instantiations
Fixes https://github.com/dart-lang/sdk/issues/61150 Change-Id: Ia3813d31e5e486c3cd8367179ba8adcc72102b31 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496403 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Keerti Parthasarathy <keertip@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
47bafbeaac
commit
47a4c9a0ae
@@ -167,7 +167,7 @@ class _CascadableExpression {
|
||||
return _CascadableExpression._internal(
|
||||
element,
|
||||
[],
|
||||
canReceive: true,
|
||||
canReceive: !node.variables.isConst,
|
||||
isCritical: true,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,19 @@ class C {
|
||||
);
|
||||
}
|
||||
|
||||
test_constInstantiation() async {
|
||||
await assertNoDiagnostics(r'''
|
||||
class A {
|
||||
const A();
|
||||
}
|
||||
|
||||
void f() {
|
||||
const a = A();
|
||||
a.toString();
|
||||
}
|
||||
''');
|
||||
}
|
||||
|
||||
test_methodCallDependsOnTarget() async {
|
||||
await assertNoDiagnostics(r'''
|
||||
class C {
|
||||
|
||||
Reference in New Issue
Block a user