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

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

Issue 1892823003: Code completion improvement, use type information when suggesting constructors (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: comments from danrubel Created 4 years, 8 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/optype.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/local_constructor_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
index 172d767b1fef9fc14b4bf169801431df746ce6b6..0d1b13d0df3f730e4e458becee4a8be67bb2226e 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
@@ -2449,6 +2449,80 @@ class C {foo(){var f; {var x;} new ^}}''');
assertNotSuggested('Foo');
}
+ test_InstanceCreationExpression_variable_declaration_filter() async {
+ addTestSource('''
+class A {} class B extends A {} class C implements A {} class D {}
+main() {
+ A a = new ^
+}''');
+ await computeSuggestions();
+
+ assertSuggestConstructor('A',
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ assertSuggestConstructor('B',
+ elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ assertSuggestConstructor('C',
+ elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ assertNotSuggested('D');
+ }
+
+ test_InstanceCreationExpression_variable_declaration_filter2() async {
+ addTestSource('''
+class A {} class B extends A {} class C implements A {} class D {}
+main() {
+ A a = new ^;
+}''');
+ await computeSuggestions();
+
+ assertSuggestConstructor('A',
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ assertSuggestConstructor('B',
+ elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ assertSuggestConstructor('C',
+ elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ assertNotSuggested('D');
+ }
+
+ test_InstanceCreationExpression_assignment_expression_filter() async {
+ addTestSource('''
+class A {} class B extends A {} class C implements A {} class D {}
+main() {
+ A a;
+ a = new ^
+}''');
+ await computeSuggestions();
+
+ assertSuggestConstructor('A',
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ assertSuggestConstructor('B',
+ elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ assertSuggestConstructor('C',
+ elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ assertNotSuggested('D');
+ }
+
+ test_InstanceCreationExpression_assignment_expression_filter2() async {
+ addTestSource('''
+class A {} class B extends A {} class C implements A {} class D {}
+main() {
+ A a;
+ a = new ^;
+}''');
+ await computeSuggestions();
+
+ assertSuggestConstructor('A',
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ assertSuggestConstructor('B',
+ elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ assertSuggestConstructor('C',
+ elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ assertNotSuggested('D');
+ }
+
test_InterpolationExpression() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource(
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/optype.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698