Skip to content

Commit 94f6532

Browse files
bwilkersoncommit-bot@chromium.org
authored andcommitted
Capture a couple of failing completions as tests
Change-Id: I9495bc60792821703373b68b2bd65650a241d343 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173882 Reviewed-by: Jaime Wren <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent c62709e commit 94f6532

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3357,6 +3357,25 @@ class R {}
33573357
assertNotSuggested('Object');
33583358
}
33593359

3360+
@failingTest
3361+
Future<void> test_functionExpression_expressionBody() async {
3362+
// This test fails because the OpType at the completion location doesn't
3363+
// allow for functions that return `void`. But because the expected return
3364+
// type is `dynamic` we probably want to allow it.
3365+
addTestSource('''
3366+
void f() {
3367+
g(() => ^);
3368+
}
3369+
void g(dynamic Function() h) {}
3370+
''');
3371+
await computeSuggestions();
3372+
3373+
expect(replacementOffset, completionOffset);
3374+
expect(replacementLength, 0);
3375+
assertSuggestFunction('f', 'void');
3376+
assertSuggestFunction('g', 'void');
3377+
}
3378+
33603379
Future<void> test_functionExpression_parameterList() async {
33613380
addTestSource('''
33623381
var c = <T>(^) {};
@@ -5187,6 +5206,20 @@ class B extends A {m() {^}}
51875206
assertSuggestMethod('m', 'B', null);
51885207
}
51895208

5209+
@failingTest
5210+
Future<void> test_parameterList_genericFunctionType() async {
5211+
// This test fails because we don't suggest `void` as the type of a
5212+
// parameter, but we should for the case of `void Function()`.
5213+
addTestSource('''
5214+
void f(^) {}
5215+
''');
5216+
await computeSuggestions();
5217+
5218+
expect(replacementOffset, completionOffset);
5219+
expect(replacementLength, 0);
5220+
assertSuggest('void');
5221+
}
5222+
51905223
Future<void> test_parameterName_excludeTypes() async {
51915224
addTestSource('m(int ^) {}');
51925225
await computeSuggestions();

0 commit comments

Comments
 (0)