[CMSR] Test that it works with FunctionTypedFormalParameter(s).

Change-Id: I86d483d379e7fe0be2dccf1659d2c6377dcc8eb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311140
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2023-06-23 19:30:12 +00:00 committed by Commit Queue
parent ecc18c9600
commit 98d7e25027

View file

@ -1967,6 +1967,38 @@ ChangeStatusFailure
''');
}
Future<void> test_topFunction_functionTypedFormalParameter() async {
await _analyzeValidSelection(r'''
void ^test(int a()) {}
void f() {
test(() => 0);
}
''');
final signatureUpdate = MethodSignatureUpdate(
formalParameters: [
FormalParameterUpdate(
id: 0,
kind: FormalParameterKind.requiredNamed,
),
],
formalParametersTrailingComma: TrailingComma.always,
argumentsTrailingComma: ArgumentsTrailingComma.ifPresent,
);
await _assertUpdate(signatureUpdate, r'''
>>>>>>> /home/test/lib/test.dart
void test({
required int a(),
}) {}
void f() {
test(a: () => 0);
}
''');
}
Future<void> test_topFunction_multipleFiles() async {
newFile('$testPackageLibPath/a.dart', r'''
import 'test.dart';