Skip to content

Commit 2b00732

Browse files
committed
[TypeLowering] Fix lexicality check for tuples.
Use the new mechanism for looking into tuples that properly handles packs.
1 parent 7e0b218 commit 2b00732

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2758,16 +2758,15 @@ bool TypeConverter::visitAggregateLeaves(
27582758
packIndex);
27592759
}
27602760
} else if (auto tupleTy = ty->getAs<TupleType>()) {
2761-
for (unsigned tupleIndex = 0, num = tupleTy->getNumElements();
2762-
tupleIndex < num; ++tupleIndex) {
2763-
auto origElementTy = origTy.getTupleElementType(tupleIndex);
2764-
auto substElementTy =
2765-
tupleTy->getElementType(tupleIndex)->getCanonicalType();
2766-
substElementTy =
2767-
computeLoweredRValueType(context, origElementTy, substElementTy);
2768-
insertIntoWorklist(substElementTy, origElementTy, nullptr,
2769-
tupleIndex);
2770-
}
2761+
unsigned tupleIndex = 0;
2762+
origTy.forEachExpandedTupleElement(
2763+
CanTupleType(tupleTy),
2764+
[&](auto origElementTy, auto substElementTy, auto element) {
2765+
substElementTy = substOpaqueTypesWithUnderlyingTypes(substElementTy, context);
2766+
insertIntoWorklist(substElementTy, origElementTy, nullptr,
2767+
tupleIndex);
2768+
++tupleIndex;
2769+
});
27712770
} else if (auto *decl = ty->getStructOrBoundGenericStruct()) {
27722771
for (auto *structField : decl->getStoredProperties()) {
27732772
auto subMap = ty->getContextSubstitutionMap(&M, decl);

0 commit comments

Comments
 (0)