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

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

Issue 1907723002: Code completion bug fix, don't suggest optional field formal parameters that are already in the con… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rebase with master 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
Index: pkg/analysis_server/test/services/completion/dart/field_formal_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/field_formal_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/field_formal_contributor_test.dart
index 2f3915936a4f21ece4b1f11da8c9645d0e7bc204..cc4d6f8383a9410c4dd024ba456f167aa533825e 100644
--- a/pkg/analysis_server/test/services/completion/dart/field_formal_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/field_formal_contributor_test.dart
@@ -164,4 +164,36 @@ class FieldFormalContributorTest extends DartCompletionContributorTest {
assertNotSuggested('Object');
assertNotSuggested('==');
}
+
+ test_ThisExpression_constructor_param_optional() async {
+ // SimpleIdentifier FieldFormalParameter FormalParameterList
+ addTestSource('''
+ main() { }
+ class Point {
+ int x;
+ int y;
+ Point({this.x, this.^}) {}
+ ''');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggestField('y', 'int', relevance: DART_RELEVANCE_LOCAL_FIELD);
+ assertNotSuggested('x');
+ }
+
+ test_ThisExpression_constructor_param_positional() async {
+ // SimpleIdentifier FieldFormalParameter FormalParameterList
+ addTestSource('''
+ main() { }
+ class Point {
+ int x;
+ int y;
+ Point({this.x, this.^}) {}
+ ''');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggestField('y', 'int', relevance: DART_RELEVANCE_LOCAL_FIELD);
+ assertNotSuggested('x');
+ }
}

Powered by Google App Engine
This is Rietveld 408576698