[CodeCompletion] Filter overloads if their function application doesn't contain the code completion token

When solving for code completion, we weren't disabling overloads because the call might be malfored in the presence of a code completion token (because the user is only now writing the function call). But this logic doesn't apply to function calls that don't even involve the code completion token, which happens if completing in result builders.

I am hoping that this significantly improves code completion performance inside result builders.
This commit is contained in:
Alex Hoppen
2022-03-21 12:57:02 +01:00
parent 17ac201b29
commit 045302b4cb

View File

@@ -10771,8 +10771,12 @@ bool ConstraintSystem::simplifyAppliedOverloadsImpl(
// Don't attempt to filter overloads when solving for code completion
// because presence of code completion token means that any call
// could be malformed e.g. missing arguments e.g. `foo([.#^MEMBER^#`
if (isForCodeCompletion())
return false;
if (isForCodeCompletion()) {
bool ArgContainsCCTypeVar = Type(argFnType).findIf(isCodeCompletionTypeVar);
if (ArgContainsCCTypeVar || isCodeCompletionTypeVar(fnTypeVar)) {
return false;
}
}
if (shouldAttemptFixes()) {
auto arguments = argFnType->getParams();