@@ -2736,7 +2736,7 @@ bool TypeConverter::visitAggregateLeaves(
27362736 return {ty->getCanonicalType (), origTy, field, index};
27372737 };
27382738 auto isAggregate = [](Type ty) {
2739- return ty->is <TupleType>() || ty->getEnumOrBoundGenericEnum () ||
2739+ return ty->is <SILPackType>() || ty-> is < TupleType>() || ty->getEnumOrBoundGenericEnum () ||
27402740 ty->getStructOrBoundGenericStruct ();
27412741 };
27422742 insertIntoWorklist (substType, origType, nullptr , llvm::None);
@@ -2747,7 +2747,17 @@ bool TypeConverter::visitAggregateLeaves(
27472747 Optional<unsigned > index;
27482748 std::tie (ty, origTy, field, index) = popFromWorklist ();
27492749 if (isAggregate (ty) && !isLeafAggregate (ty, origTy, field, index)) {
2750- if (auto tupleTy = ty->getAs <TupleType>()) {
2750+ if (auto packTy = ty->getAs <SILPackType>()) {
2751+ for (auto packIndex : indices (packTy->getElementTypes ())) {
2752+ auto origElementTy = origTy.getPackElementType (packIndex);
2753+ auto substElementTy =
2754+ packTy->getElementType (packIndex)->getCanonicalType ();
2755+ substElementTy =
2756+ computeLoweredRValueType (context, origElementTy, substElementTy);
2757+ insertIntoWorklist (substElementTy, origElementTy, nullptr ,
2758+ packIndex);
2759+ }
2760+ } else if (auto tupleTy = ty->getAs <TupleType>()) {
27512761 for (unsigned tupleIndex = 0 , num = tupleTy->getNumElements ();
27522762 tupleIndex < num; ++tupleIndex) {
27532763 auto origElementTy = origTy.getTupleElementType (tupleIndex);
@@ -2826,9 +2836,9 @@ void TypeConverter::verifyLowering(const TypeLowering &lowering,
28262836 // The field's type is an aggregate. Treat it as a leaf if it
28272837 // has a lifetime annotation.
28282838
2829- // If it's a field of a tuple or the top-level type, there's no value
2830- // decl on which to look for an attribute. It's a leaf iff the type
2831- // has a lifetime annotation.
2839+ // If it's a field of a tuple, pack or the top-level type, there's no
2840+ // value decl on which to look for an attribute. It's a leaf iff the
2841+ // type has a lifetime annotation.
28322842 if (index || !field)
28332843 return getLifetimeAnnotation (ty).isSome ();
28342844
0 commit comments