@@ -2736,7 +2736,7 @@ bool TypeConverter::visitAggregateLeaves(
2736
2736
return {ty->getCanonicalType (), origTy, field, index};
2737
2737
};
2738
2738
auto isAggregate = [](Type ty) {
2739
- return ty->is <TupleType>() || ty->getEnumOrBoundGenericEnum () ||
2739
+ return ty->is <SILPackType>() || ty-> is < TupleType>() || ty->getEnumOrBoundGenericEnum () ||
2740
2740
ty->getStructOrBoundGenericStruct ();
2741
2741
};
2742
2742
insertIntoWorklist (substType, origType, nullptr , llvm::None);
@@ -2747,7 +2747,17 @@ bool TypeConverter::visitAggregateLeaves(
2747
2747
Optional<unsigned > index;
2748
2748
std::tie (ty, origTy, field, index) = popFromWorklist ();
2749
2749
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>()) {
2751
2761
for (unsigned tupleIndex = 0 , num = tupleTy->getNumElements ();
2752
2762
tupleIndex < num; ++tupleIndex) {
2753
2763
auto origElementTy = origTy.getTupleElementType (tupleIndex);
@@ -2826,9 +2836,9 @@ void TypeConverter::verifyLowering(const TypeLowering &lowering,
2826
2836
// The field's type is an aggregate. Treat it as a leaf if it
2827
2837
// has a lifetime annotation.
2828
2838
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.
2832
2842
if (index || !field)
2833
2843
return getLifetimeAnnotation (ty).isSome ();
2834
2844
0 commit comments