[AST] Adjust TypeBase::getTypeVariables to accept a set

Currently the pattern is to collect the type variables and then unique
them. Instead of asking clients to do uniquing, let's just accept a set
as an argument.
This commit is contained in:
Pavel Yaskevich
2021-01-26 18:08:36 -08:00
parent 4988127e99
commit b03dc63634
9 changed files with 76 additions and 112 deletions

View File

@@ -10549,13 +10549,16 @@ ConstraintSystem::addArgumentConversionConstraintImpl(
if (auto *argTypeVar = first->getAs<TypeVariableType>()) {
if (argTypeVar->getImpl().isClosureType()) {
// Extract any type variables present in the parameter's result builder.
SmallVector<TypeVariableType *, 4> typeVars;
SmallPtrSet<TypeVariableType *, 4> typeVars;
if (auto builderTy = getOpenedResultBuilderTypeFor(*this, locator))
builderTy->getTypeVariables(typeVars);
SmallVector<TypeVariableType *, 4> referencedVars{typeVars.begin(),
typeVars.end()};
auto *loc = getConstraintLocator(locator);
addUnsolvedConstraint(
Constraint::create(*this, kind, first, second, loc, typeVars));
Constraint::create(*this, kind, first, second, loc, referencedVars));
return SolutionKind::Solved;
}
}