Skip to content

Commit a4701f7

Browse files
committed
[ConstraintSystem] Adjust overload filtering to be less aggressive in code completion mode
Avoid filtering overloads for calls which have code completion token as an argument, that would always undesired results, because such calls could be missing arguments before or after the token.
1 parent 4aabd27 commit a4701f7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8531,6 +8531,12 @@ bool ConstraintSystem::simplifyAppliedOverloadsImpl(
85318531
Constraint *disjunction, TypeVariableType *fnTypeVar,
85328532
const FunctionType *argFnType, unsigned numOptionalUnwraps,
85338533
ConstraintLocatorBuilder locator) {
8534+
// Don't attempt to filter overloads when solving for code completion
8535+
// because presence of code completion token means that any call
8536+
// could be malformed e.g. missing arguments e.g. `foo([.#^MEMBER^#`
8537+
if (isForCodeCompletion())
8538+
return false;
8539+
85348540
if (shouldAttemptFixes()) {
85358541
auto arguments = argFnType->getParams();
85368542
bool allHoles =

0 commit comments

Comments
 (0)