mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #62713 from hborla/open-pack-element-type-repr
[ConstraintSystem] Enable pack element type reprs in expressions.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user