Only suggest non-void members in string interpolations
Bug: https://github.com/dart-lang/sdk/issues/54682 Change-Id: I03a7fc0dc6f914b65775c84124b963929a9813bd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347980 Reviewed-by: Samuel Rawlins <srawlins@google.com> Auto-Submit: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
committed by
Commit Queue
parent
389d66a515
commit
0dcef64e67
@@ -1229,7 +1229,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
|
||||
@override
|
||||
void visitInterpolationExpression(InterpolationExpression node) {
|
||||
declarationHelper(mustBeStatic: node.inStaticContext)
|
||||
declarationHelper(mustBeStatic: node.inStaticContext, mustBeNonVoid: true)
|
||||
.addLexicalDeclarations(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,30 @@ import '../../../../client/completion_driver_test.dart';
|
||||
|
||||
void main() {
|
||||
defineReflectiveSuite(() {
|
||||
defineReflectiveTests(StringInterpolationTest);
|
||||
defineReflectiveTests(StringLiteralTest);
|
||||
});
|
||||
}
|
||||
|
||||
@reflectiveTest
|
||||
class StringInterpolationTest extends AbstractCompletionDriverTest
|
||||
with StringInterpolationTestCases {}
|
||||
|
||||
mixin StringInterpolationTestCases on AbstractCompletionDriverTest {
|
||||
Future<void> test_inBraces_nonVoid() async {
|
||||
await computeSuggestions(r'''
|
||||
var s = 'a ${^} b';
|
||||
void f0() {}
|
||||
int f1() {}
|
||||
''');
|
||||
assertResponse(r'''
|
||||
suggestions
|
||||
f1
|
||||
kind: functionInvocation
|
||||
''');
|
||||
}
|
||||
}
|
||||
|
||||
@reflectiveTest
|
||||
class StringLiteralTest extends AbstractCompletionDriverTest
|
||||
with StringLiteralTestCases {}
|
||||
|
||||
Reference in New Issue
Block a user