[DAS] Fixes record extension field completion
Bug: https://github.com/dart-lang/sdk/issues/60625 Change-Id: I23e4a5a85dc15059c9b1e658fb2fc3f868fa91a7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424684 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com> Auto-Submit: Felipe Morschel <git@fmorschel.dev>
This commit is contained in:
@@ -1317,6 +1317,8 @@ class DeclarationHelper {
|
||||
includeMethods: true,
|
||||
includeSetters: true,
|
||||
);
|
||||
} else if (thisType is RecordType) {
|
||||
_addFieldsOfRecordType(type: thisType, excludedFields: {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,20 @@ suggestions
|
||||
''');
|
||||
}
|
||||
|
||||
Future<void> test_inMethod_namedRecordFields() async {
|
||||
allowedIdentifiers = {'value1'};
|
||||
await computeSuggestions('''
|
||||
extension E on ({int value1,}) {foo() { val^;} }
|
||||
''');
|
||||
assertResponse(r'''
|
||||
replacement
|
||||
left: 3
|
||||
suggestions
|
||||
value1
|
||||
kind: identifier
|
||||
''');
|
||||
}
|
||||
|
||||
Future<void> test_inMethod_parameterShadowField() async {
|
||||
allowedIdentifiers = {'aaa'};
|
||||
await computeSuggestions('''
|
||||
@@ -142,6 +156,22 @@ suggestions
|
||||
kind: parameter
|
||||
assert
|
||||
kind: keyword
|
||||
''');
|
||||
}
|
||||
|
||||
Future<void> test_inMethod_positionalRecordFields() async {
|
||||
allowedIdentifiers = {r'$1', r'$2'};
|
||||
await computeSuggestions(r'''
|
||||
extension E on (int, String,) {foo() { $^;} }
|
||||
''');
|
||||
assertResponse(r'''
|
||||
replacement
|
||||
left: 1
|
||||
suggestions
|
||||
$1
|
||||
kind: identifier
|
||||
$2
|
||||
kind: identifier
|
||||
''');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user