mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user