Merge pull request #62713 from hborla/open-pack-element-type-repr

[ConstraintSystem] Enable pack element type reprs in expressions.
This commit is contained in:
Holly Borla
2022-12-21 10:48:42 -05:00
committed by GitHub
20 changed files with 304 additions and 94 deletions

View File

@@ -780,7 +780,8 @@ Type ConstraintSystem::openUnboundGenericType(GenericTypeDecl *decl,
TypeResolution::forInterface(
DC, None,
[](auto) -> Type { llvm_unreachable("should not be used"); },
[](auto &, auto) -> Type { llvm_unreachable("should not be used"); })
[](auto &, auto) -> Type { llvm_unreachable("should not be used"); },
[](auto, auto) -> Type { llvm_unreachable("should not be used"); })
.applyUnboundGenericArguments(decl, parentTy, SourceLoc(), arguments);
if (!parentTy && !isTypeResolution) {
result = DC->mapTypeIntoContext(result);
@@ -1281,6 +1282,10 @@ Type ConstraintSystem::getUnopenedTypeOfReference(
Type requestedType =
getType(value)->getWithoutSpecifierType()->getReferenceStorageReferent();
// Strip pack expansion types off of pack references.
if (auto *expansion = requestedType->getAs<PackExpansionType>())
requestedType = expansion->getPatternType();
// Adjust the type for concurrency if requested.
if (adjustForPreconcurrency)
requestedType = adjustVarTypeForConcurrency(
@@ -1596,7 +1601,8 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
auto type =
TypeResolution::forInterface(useDC, TypeResolverContext::InExpression,
/*unboundTyOpener*/ nullptr,
/*placeholderHandler*/ nullptr)
/*placeholderHandler*/ nullptr,
/*packElementOpener*/ nullptr)
.resolveTypeInContext(typeDecl, /*foundDC*/ nullptr,
/*isSpecialized=*/false);
type = useDC->mapTypeIntoContext(type);
@@ -2957,7 +2963,8 @@ FunctionType::ExtInfo ClosureEffectsRequest::evaluate(
castType = TypeResolution::resolveContextualType(
castTypeRepr, DC, TypeResolverContext::InExpression,
/*unboundTyOpener*/ nullptr,
/*placeholderHandler*/ nullptr);
/*placeholderHandler*/ nullptr,
/*packElementOpener*/ nullptr);
} else {
castType = isp->getCastType();
}