File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1939,18 +1939,18 @@ bool TypeCheckASTNodeAtLocRequest::evaluate(Evaluator &evaluator,
1939
1939
if (Type builderType = getResultBuilderType (func)) {
1940
1940
auto optBody =
1941
1941
TypeChecker::applyResultBuilderBodyTransform (func, builderType);
1942
+ if (ctx.CompletionCallback && ctx.CompletionCallback ->gotCallback ()) {
1943
+ // We already informed the completion callback of solutions found by
1944
+ // type checking the entire result builder from
1945
+ // applyResultBuilderBodyTransform. No need to typecheck the requested
1946
+ // AST node individually anymore.
1947
+ return false ;
1948
+ }
1942
1949
if (optBody && *optBody) {
1943
1950
// Wire up the function body now.
1944
1951
func->setBody (*optBody, AbstractFunctionDecl::BodyKind::TypeChecked);
1945
1952
return false ;
1946
1953
}
1947
- // FIXME: We failed to apply the result builder transform. Fall back to
1948
- // just type checking the node that contains the code completion token.
1949
- // This may be missing some context from the result builder but in
1950
- // practice it often contains sufficient information to provide a decent
1951
- // level of code completion that's better than providing nothing at all.
1952
- // The proper solution would be to only partially type check the result
1953
- // builder so that this fall back would not be necessary.
1954
1954
} else if (func->hasSingleExpressionBody () &&
1955
1955
func->getResultInterfaceType ()->isVoid ()) {
1956
1956
// The function returns void. We don't need an explicit return, no matter
You can’t perform that action at this time.
0 commit comments