Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(832)

Unified Diff: pkg/analysis_server/test/search/element_references_test.dart

Issue 2176173004: Issue 26926. Don't search hierarchy for static class members. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/search/element_references_test.dart
diff --git a/pkg/analysis_server/test/search/element_references_test.dart b/pkg/analysis_server/test/search/element_references_test.dart
index 809a962237e4db5c792a56b8c6939b77a182dac7..cdd7e13dfee655fe151d69154e638f531e8d88dd 100644
--- a/pkg/analysis_server/test/search/element_references_test.dart
+++ b/pkg/analysis_server/test/search/element_references_test.dart
@@ -268,13 +268,13 @@ main() {
test_hierarchy_method() async {
addTestFile('''
class A {
- mmm() {} // in A
+ mmm(_) {} // in A
}
class B extends A {
- mmm() {} // in B
+ mmm(_) {} // in B
}
class C extends B {
- mmm() {} // in C
+ mmm(_) {} // in C
}
main(A a, B b, C c) {
a.mmm(10);
@@ -282,13 +282,36 @@ main(A a, B b, C c) {
c.mmm(30);
}
''');
- await findElementReferences('mmm() {} // in B', false);
+ await findElementReferences('mmm(_) {} // in B', false);
expect(searchElement.kind, ElementKind.METHOD);
assertHasResult(SearchResultKind.INVOCATION, 'mmm(10)');
assertHasResult(SearchResultKind.INVOCATION, 'mmm(20)');
assertHasResult(SearchResultKind.INVOCATION, 'mmm(30)');
}
+ test_hierarchy_method_static() async {
+ addTestFile('''
+class A {
+ static void mmm(_) {} // in A
+}
+class B extends A {
+ static void mmm(_) {} // in B
+}
+class C extends B {
+ static void mmm(_) {} // in C
+}
+main() {
+ A.mmm(10);
+ B.mmm(20);
+ C.mmm(30);
+}
+''');
+ await findElementReferences('mmm(_) {} // in B', false);
+ expect(searchElement.kind, ElementKind.METHOD);
+ expect(results, hasLength(1));
+ assertHasResult(SearchResultKind.INVOCATION, 'mmm(20)');
+ }
+
test_label() async {
addTestFile('''
main() {

Powered by Google App Engine
This is Rietveld 408576698