Skip to content

Commit b485a27

Browse files
stereotype441Commit Queue
authored andcommitted
[analyzer] Lock down a few behaviors of DeprecatedMemberUseVerifier.
In a follow-up CL, I plan to rework the `DeprecatedMemberUseVerifier` class in a way that allows it to be more easily extended to support the `@experimental` annotation. This CL adds some unit tests for some behaviors of `DeprecatedMemberUseVerifier` that were not previously tested, so that I won't accidentally regress them in the follow-up CL. Change-Id: I6a6a696494843826f3f9213c3191910369aa4ba2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450361 Commit-Queue: Paul Berry <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]>
1 parent 96ca861 commit b485a27

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,40 @@ class A {
13161316
''');
13171317
}
13181318

1319+
test_methodInvocation_nonUseKind() async {
1320+
newFile('$workspaceRootPath/aaa/lib/a.dart', r'''
1321+
class A {
1322+
@Deprecated.extend()
1323+
void foo() {}
1324+
}
1325+
''');
1326+
1327+
await assertNoErrorsInCode(r'''
1328+
import 'package:aaa/a.dart';
1329+
1330+
void f(A a) {
1331+
a.foo();
1332+
}
1333+
''');
1334+
}
1335+
1336+
test_methodInvocation_unrelatedAnnotation() async {
1337+
newFile('$workspaceRootPath/aaa/lib/a.dart', r'''
1338+
class A {
1339+
@override
1340+
void foo() {}
1341+
}
1342+
''');
1343+
1344+
await assertNoErrorsInCode(r'''
1345+
import 'package:aaa/a.dart';
1346+
1347+
void f(A a) {
1348+
a.foo();
1349+
}
1350+
''');
1351+
}
1352+
13191353
test_methodInvocation_withMessage() async {
13201354
newFile('$workspaceRootPath/aaa/lib/a.dart', r'''
13211355
class A {

0 commit comments

Comments
 (0)