Skip to content

Commit 10cbc8f

Browse files
pqCommit Queue
authored and
Commit Queue
committed
[wildcards] ensure signatures with wildcard params have types
See: #55681 Change-Id: Ibbb2771cea0311a6bf2145f663efff07f2f97d31 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378340 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Phil Quitslund <[email protected]>
1 parent 932be2e commit 10cbc8f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pkg/analysis_server/test/analysis/get_signature_test.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,25 @@ void f() {
427427
ParameterInfo(ParameterKind.REQUIRED_POSITIONAL, 'length', 'int')));
428428
}
429429

430+
Future<void> test_function_wildcardParams() async {
431+
newFile(testFilePath, '''
432+
void g(int _, [String _]) {}
433+
void f() {
434+
g(/*^*/);
435+
}
436+
''');
437+
var result = await prepareSignature('/*^*/');
438+
expect(result.name, equals('g'));
439+
expect(result.parameters, hasLength(2));
440+
// Ensure wildcard params have their types.
441+
expect(result.parameters[0],
442+
equals(ParameterInfo(ParameterKind.REQUIRED_POSITIONAL, '_', 'int')));
443+
expect(
444+
result.parameters[1],
445+
equals(
446+
ParameterInfo(ParameterKind.OPTIONAL_POSITIONAL, '_', 'String')));
447+
}
448+
430449
Future<void> test_function_zero_arguments() async {
431450
newFile(testFilePath, '''
432451
/// one doc

0 commit comments

Comments
 (0)