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

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

Issue 2679503002: suggest method references in named expressions (Closed)
Patch Set: merge Created 3 years, 10 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/test/services/completion/completion_target_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/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 20cf6ef9f9da8adc20f0cd3e6034f44d3477247c..45624f2c583401a1984a2b65a1a8095e2d8e14a3 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
@@ -262,7 +262,7 @@ import 'dart:async';
import '/libA.dart';
class B { }
String bar(f()) => true;
-void main() {bar(^);}''');
+void main() {boo(){} bar(^);}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@@ -271,6 +271,45 @@ void main() {bar(^);}''');
assertSuggestFunction('bar', 'String',
kind: CompletionSuggestionKind.IDENTIFIER,
relevance: DART_RELEVANCE_LOCAL_FUNCTION);
+ assertSuggestFunction('boo', 'dynamic',
+ kind: CompletionSuggestionKind.IDENTIFIER,
+ relevance: DART_RELEVANCE_LOCAL_FUNCTION);
+ assertNotSuggested('hasLength');
+ assertNotSuggested('identical');
+ assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER);
+ assertNotSuggested('A');
+ assertNotSuggested('Object');
+ assertNotSuggested('main');
+ assertNotSuggested('baz');
+ assertNotSuggested('print');
+ }
+
+ test_ArgumentList_MethodInvocation_functionalArg2() async {
+ // ArgumentList MethodInvocation ExpressionStatement Block
+ addSource(
+ '/libA.dart',
+ '''
+library A;
+class A { A(f()) { } }
+bool hasLength(int expected) { }
+void baz() { }''');
+ addTestSource('''
+import 'dart:async';
+import '/libA.dart';
+class B { }
+String bar({inc()}) => true;
+void main() {boo(){} bar(inc: ^);}''');
+ await computeSuggestions();
+
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
+ assertSuggestFunction('bar', 'String',
+ kind: CompletionSuggestionKind.IDENTIFIER,
+ relevance: DART_RELEVANCE_LOCAL_FUNCTION + DART_RELEVANCE_INCREMENT);
+ assertSuggestFunction('boo', 'dynamic',
+ kind: CompletionSuggestionKind.IDENTIFIER,
+ relevance: DART_RELEVANCE_LOCAL_FUNCTION + DART_RELEVANCE_INCREMENT);
assertNotSuggested('hasLength');
assertNotSuggested('identical');
assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER);
« no previous file with comments | « pkg/analysis_server/test/services/completion/completion_target_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698