@@ -2733,7 +2733,7 @@ bool TypeConverter::visitAggregateLeaves(
2733
2733
return {ty->getCanonicalType (), origTy, field, index};
2734
2734
};
2735
2735
auto isAggregate = [](Type ty) {
2736
- return ty->is <TupleType>() || ty->getEnumOrBoundGenericEnum () ||
2736
+ return ty->is <SILPackType>() || ty-> is < TupleType>() || ty->getEnumOrBoundGenericEnum () ||
2737
2737
ty->getStructOrBoundGenericStruct ();
2738
2738
};
2739
2739
insertIntoWorklist (substType, origType, nullptr , llvm::None);
@@ -2744,7 +2744,17 @@ bool TypeConverter::visitAggregateLeaves(
2744
2744
Optional<unsigned > index;
2745
2745
std::tie (ty, origTy, field, index) = popFromWorklist ();
2746
2746
if (isAggregate (ty) && !isLeafAggregate (ty, origTy, field, index)) {
2747
- if (auto tupleTy = ty->getAs <TupleType>()) {
2747
+ if (auto packTy = ty->getAs <SILPackType>()) {
2748
+ for (auto packIndex : indices (packTy->getElementTypes ())) {
2749
+ auto origElementTy = origTy.getPackElementType (packIndex);
2750
+ auto substElementTy =
2751
+ packTy->getElementType (packIndex)->getCanonicalType ();
2752
+ substElementTy =
2753
+ computeLoweredRValueType (context, origElementTy, substElementTy);
2754
+ insertIntoWorklist (substElementTy, origElementTy, nullptr ,
2755
+ packIndex);
2756
+ }
2757
+ } else if (auto tupleTy = ty->getAs <TupleType>()) {
2748
2758
for (unsigned tupleIndex = 0 , num = tupleTy->getNumElements ();
2749
2759
tupleIndex < num; ++tupleIndex) {
2750
2760
auto origElementTy = origTy.getTupleElementType (tupleIndex);
@@ -2822,9 +2832,9 @@ void TypeConverter::verifyLowering(const TypeLowering &lowering,
2822
2832
// The field's type is an aggregate. Treat it as a leaf if it
2823
2833
// has a lifetime annotation.
2824
2834
2825
- // If it's a field of a tuple or the top-level type, there's no value
2826
- // decl on which to look for an attribute. It's a leaf iff the type
2827
- // has a lifetime annotation.
2835
+ // If it's a field of a tuple, pack or the top-level type, there's no
2836
+ // value decl on which to look for an attribute. It's a leaf iff the
2837
+ // type has a lifetime annotation.
2828
2838
if (index || !field)
2829
2839
return getLifetimeAnnotation (ty).isSome ();
2830
2840
0 commit comments