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

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

Issue 1882243003: Code completion improvement: in NamedExpressions (m(someNamedParam: ^)), use type information to so… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comments from DanR 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_reference_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index e617931231d0c1a055a40179739a39e2954f5f26..50f8ec3612f92fd3c123a890afac67734d7619bc 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -362,7 +362,7 @@ f(A a){ (a as ^) }''');
assertNotSuggested('Object');
}
- test_IsExpression_type_filter_implements() async {
+ test_AsExpression_type_filter_implements() async {
// SimpleIdentifier TypeName AsExpression
addTestSource('''
class A {} class B implements A {} class C implements A {} class D {}
@@ -1874,6 +1874,42 @@ class A {a(blat: ^) { }}''');
assertNotSuggested('bar');
}
+ test_DefaultFormalParameter_named_expression_filter() async {
+ // DefaultFormalParameter FormalParameterList MethodDeclaration
+ addTestSource('''
+ class A {}
+ class B extends A {}
+ class C implements A {}
+ class D {}
+ class E {
+ A a;
+ E({A someA});
+ }
+ A a = new A();
+ B b = new B();
+ C c = new C();
+ D d = new D();
+ E e = new E(someA: ^);
+ ''');
+ await computeSuggestions();
+
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggestTopLevelVar('a', 'A',
+ relevance:
+ DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
+ assertSuggestTopLevelVar('b', 'B',
+ relevance:
+ DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
+ assertSuggestTopLevelVar('c', 'C',
+ relevance:
+ DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
+ assertSuggestTopLevelVar('d', 'D',
+ relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE);
+ assertSuggestTopLevelVar('e', 'E',
+ relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE);
+ }
+
test_enum() async {
addTestSource('enum E { one, two } main() {^}');
await computeSuggestions();
@@ -2798,10 +2834,10 @@ f(A a){ if (a is ^) {}}''');
assertNotSuggested('Object');
}
- test_IsExpression_type_subtype_implements_filter() async {
+ test_IsExpression_type_filter_implements() async {
// SimpleIdentifier TypeName IsExpression IfStatement
addTestSource('''
-class A {} class B extends A {} class C implements A {} class D {}
+class A {} class B implements A {} class C implements A {} class D {}
f(A a){ if (a is ^) {}}''');
await computeSuggestions();
« 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