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

Unified Diff: pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart

Issue 1516883002: do not suggest completions for cascade on library prefix - fixes #25215 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years 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
« no previous file with comments | « pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
index 345c6558b68379b87957acdb2245218b00e608d8..6efd8ab28192b42b250860efc0929bce26e03518 100644
--- a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
@@ -113,6 +113,38 @@ class StaticMemberContributorTest extends DartCompletionContributorTest {
assertSuggestField('values', 'List<E>');
}
+ test_enumConst_cascade1() async {
+ addTestSource('enum E { one, two } main() {E..^}');
+ await computeSuggestions();
+ assertNoSuggestions();
+ }
+
+ test_enumConst_cascade2() async {
+ addTestSource('enum E { one, two } main() {E.^.}');
+ await computeSuggestions();
+ assertNotSuggested('E');
+ assertSuggestEnumConst('one');
+ assertSuggestEnumConst('two');
+ assertNotSuggested('index');
+ assertSuggestField('values', 'List<E>');
+ }
+
+ test_enumConst_cascade3() async {
+ addTestSource('enum E { one, two } main() {E..o^}');
+ await computeSuggestions();
+ assertNoSuggestions();
+ }
+
+ test_enumConst_cascade4() async {
+ addTestSource('enum E { one, two } main() {E.^.o}');
+ await computeSuggestions();
+ assertNotSuggested('E');
+ assertSuggestEnumConst('one');
+ assertSuggestEnumConst('two');
+ assertNotSuggested('index');
+ assertSuggestField('values', 'List<E>');
+ }
+
test_keyword() async {
addTestSource('class C { static C get instance => null; } main() {C.in^}');
await computeSuggestions();
@@ -160,4 +192,98 @@ void main() {C.^ print("something");}''');
assertNotSuggested('m1');
assertSuggestMethod('m2', 'C', null);
}
+
+ test_only_static_cascade1() async {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('''
+class B {
+ static int b1;
+}
+class C extends B {
+ int f1;
+ static int f2;
+ m1() {}
+ static m2() {}
+}
+void main() {C..^}''');
+ await computeSuggestions();
+ assertNoSuggestions();
+ }
+
+ test_only_static_cascade2() async {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('''
+class B {
+ static int b1;
+}
+class C extends B {
+ int f1;
+ static int f2;
+ m1() {}
+ static m2() {}
+}
+void main() {C.^.}''');
+ await computeSuggestions();
+ assertNotSuggested('b1');
+ assertNotSuggested('f1');
+ assertSuggestField('f2', 'int');
+ assertNotSuggested('m1');
+ assertSuggestMethod('m2', 'C', null);
+ }
+
+ test_only_static_cascade3() async {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('''
+class B {
+ static int b1;
+}
+class C extends B {
+ int f1;
+ static int f2;
+ m1() {}
+ static m2() {}
+}
+void main() {C..m^()}''');
+ await computeSuggestions();
+ assertNoSuggestions();
+ }
+
+ test_only_static_cascade4() async {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('''
+class B {
+ static int b1;
+}
+class C extends B {
+ int f1;
+ static int f2;
+ m1() {}
+ static m2() {}
+}
+void main() {C.^.m()}''');
+ await computeSuggestions();
+ assertNotSuggested('b1');
+ assertNotSuggested('f1');
+ assertSuggestField('f2', 'int');
+ assertNotSuggested('m1');
+ assertSuggestMethod('m2', 'C', null);
+ }
+
+ test_only_static_cascade_prefixed1() async {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('''
+import "dart:async" as async;
+void main() {async.Future..w^()}''');
+ await computeSuggestions();
+ assertNoSuggestions();
+ }
+
+ test_only_static_cascade_prefixed2() async {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('''
+import "dart:async" as async;
+void main() {async.Future.^.w()}''');
+ await computeSuggestions();
+ assertSuggestMethod('wait', 'Future', 'Future<dynamic>');
+ }
}
« no previous file with comments | « pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698