mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Add helper methods to GenericTypeParamType for converting a given type
parameter to and from a pack type parameter.
This commit is contained in:
@@ -8432,6 +8432,7 @@ ConstraintSystem::SolutionKind
|
||||
ConstraintSystem::simplifyPackElementOfConstraint(Type first, Type second,
|
||||
TypeMatchOptions flags,
|
||||
ConstraintLocatorBuilder locator) {
|
||||
ASTContext &ctx = getASTContext();
|
||||
auto elementType = simplifyType(first, flags);
|
||||
auto *loc = getConstraintLocator(locator);
|
||||
|
||||
@@ -8454,10 +8455,7 @@ ConstraintSystem::simplifyPackElementOfConstraint(Type first, Type second,
|
||||
return type;
|
||||
|
||||
auto *elementParam = element->mapTypeOutOfContext()->getAs<GenericTypeParamType>();
|
||||
auto *pack = GenericTypeParamType::get(/*isParameterPack*/true,
|
||||
elementParam->getDepth(),
|
||||
elementParam->getIndex(),
|
||||
this->getASTContext());
|
||||
auto *pack = elementParam->asParameterPack(ctx);
|
||||
return this->DC->mapTypeIntoContext(pack);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user