Skip to content

Commit 98d7e25

Browse files
scheglovCommit Queue
authored andcommitted
[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 <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent ecc18c9 commit 98d7e25

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

pkg/analysis_server/test/services/refactoring/agnostic/change_method_signature_test.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,6 +1967,38 @@ ChangeStatusFailure
19671967
''');
19681968
}
19691969

1970+
Future<void> test_topFunction_functionTypedFormalParameter() async {
1971+
await _analyzeValidSelection(r'''
1972+
void ^test(int a()) {}
1973+
1974+
void f() {
1975+
test(() => 0);
1976+
}
1977+
''');
1978+
1979+
final signatureUpdate = MethodSignatureUpdate(
1980+
formalParameters: [
1981+
FormalParameterUpdate(
1982+
id: 0,
1983+
kind: FormalParameterKind.requiredNamed,
1984+
),
1985+
],
1986+
formalParametersTrailingComma: TrailingComma.always,
1987+
argumentsTrailingComma: ArgumentsTrailingComma.ifPresent,
1988+
);
1989+
1990+
await _assertUpdate(signatureUpdate, r'''
1991+
>>>>>>> /home/test/lib/test.dart
1992+
void test({
1993+
required int a(),
1994+
}) {}
1995+
1996+
void f() {
1997+
test(a: () => 0);
1998+
}
1999+
''');
2000+
}
2001+
19702002
Future<void> test_topFunction_multipleFiles() async {
19712003
newFile('$testPackageLibPath/a.dart', r'''
19722004
import 'test.dart';

0 commit comments

Comments
 (0)