Skip to content

Commit 1a60f94

Browse files
jwrencommit-bot@chromium.org
authored andcommitted
Add two failing tests in the local_reference_contributor_test.dart, after some for(var foo ...) ^, the completion is in the implicit statement which is in the scope of the foo declaration.
I imagine that similar tests could/ should be written for other such ASTs. Change-Id: Iea059af339e5dec34a937ed2c28fe55fdb072fc6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153100 Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Jaime Wren <[email protected]>
1 parent 1b1fcc0 commit 1a60f94

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2995,6 +2995,32 @@ main() {
29952995
assertNotSuggested('String');
29962996
}
29972997

2998+
@failingTest
2999+
Future<void> test_ForEachStatement_statement_typed() async {
3000+
// Statement ForEachStatement
3001+
addTestSource('main(args) {for (int foo in bar) ^}');
3002+
await computeSuggestions();
3003+
3004+
expect(replacementOffset, completionOffset);
3005+
expect(replacementLength, 0);
3006+
assertSuggestParameter('args', null);
3007+
assertSuggestLocalVariable('foo', 'int');
3008+
assertNotSuggested('Object');
3009+
}
3010+
3011+
@failingTest
3012+
Future<void> test_ForEachStatement_statement_untyped() async {
3013+
// Statement ForEachStatement
3014+
addTestSource('main(args) {for (var foo in bar) ^}');
3015+
await computeSuggestions();
3016+
3017+
expect(replacementOffset, completionOffset);
3018+
expect(replacementLength, 0);
3019+
assertSuggestParameter('args', null);
3020+
assertSuggestLocalVariable('foo', null);
3021+
assertNotSuggested('Object');
3022+
}
3023+
29983024
Future<void> test_FormalParameterList() async {
29993025
// FormalParameterList MethodDeclaration
30003026
addTestSource('''

0 commit comments

Comments
 (0)