Merge pull request #41917 from ahoppen/pr/filter-overloads-if-no-cc-token

[CodeCompletion] Filter overloads if their function application doesn't contain the code completion token
This commit is contained in:
Alex Hoppen
2022-03-22 12:11:29 +01:00
committed by GitHub

View File

@@ -10774,8 +10774,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();