Skip to content

Commit eef4716

Browse files
committed
[Completion] Avoid doing extra type-checking in CSApply
Avoid type-checking local decls and macros, the type-checking here should instead be handled by TypeCheckASTNodeAtLocRequest.
1 parent fab09c5 commit eef4716

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/Sema/CSApply.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5620,16 +5620,20 @@ namespace {
56205620
.fixItInsert(coercion->getStartLoc(), "consume ");
56215621
}
56225622

5623-
// Type-check any local decls encountered.
5624-
for (auto *D : LocalDeclsToTypeCheck)
5625-
TypeChecker::typeCheckDecl(D);
5626-
5627-
// Expand any macros encountered.
5628-
// FIXME: Expansion should be lazy.
5629-
auto &eval = cs.getASTContext().evaluator;
5630-
for (auto *E : MacrosToExpand) {
5631-
(void)evaluateOrDefault(eval, ExpandMacroExpansionExprRequest{E},
5632-
std::nullopt);
5623+
// If we're doing code completion, avoid doing any further type-checking,
5624+
// that should instead be handled by TypeCheckASTNodeAtLocRequest.
5625+
if (!ctx.CompletionCallback) {
5626+
// Type-check any local decls encountered.
5627+
for (auto *D : LocalDeclsToTypeCheck)
5628+
TypeChecker::typeCheckDecl(D);
5629+
5630+
// Expand any macros encountered.
5631+
// FIXME: Expansion should be lazy.
5632+
auto &eval = cs.getASTContext().evaluator;
5633+
for (auto *E : MacrosToExpand) {
5634+
(void)evaluateOrDefault(eval, ExpandMacroExpansionExprRequest{E},
5635+
std::nullopt);
5636+
}
56335637
}
56345638
}
56355639

0 commit comments

Comments
 (0)