[ConstraintSystem] Record parameter bindings in solutions (NFC)

This saves us from needing to re-match args to params in CSApply and is also
useful for a forthcoming change migrating code completion in argument position
to use the solver-based typeCheckForCodeCompletion api.

rdar://76581093
This commit is contained in:
Nathan Hawes
2021-04-03 08:17:47 +10:00
parent 59a218a50a
commit c57c403ffa
8 changed files with 138 additions and 116 deletions

View File

@@ -3065,6 +3065,16 @@ Type ConstraintSystem::simplifyType(Type type) const {
});
}
void Solution::recordSingleArgMatchingChoice(ConstraintLocator *locator) {
auto &cs = getConstraintSystem();
assert(argumentMatchingChoices.find(locator) ==
argumentMatchingChoices.end() &&
"recording multiple bindings for same locator");
argumentMatchingChoices.insert(
{cs.getConstraintLocator(locator, ConstraintLocator::ApplyArgument),
MatchCallArgumentResult::forArity(1)});
}
Type Solution::simplifyType(Type type) const {
if (!(type->hasTypeVariable() || type->hasPlaceholder()))
return type;