Skip to content

Commit c6e8590

Browse files
Merge pull request swiftlang#78229 from omochi/fix-variadic-optional-crash
Fix a crash in type lowering verification when using variadic optional tuples
2 parents 68c1e54 + 37c1775 commit c6e8590

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3022,6 +3022,9 @@ bool TypeConverter::visitAggregateLeaves(
30223022
std::optional<unsigned> index;
30233023
std::tie(ty, origTy, field, index) = popFromWorklist();
30243024
assert(!field || !index && "both field and index!?");
3025+
if (auto origEltTy = origTy.getVanishingTupleElementPatternType()) {
3026+
origTy = *origEltTy;
3027+
}
30253028
if (isAggregate(ty) && !isLeafAggregate(ty, origTy, field, index)) {
30263029
if (auto packTy = dyn_cast<SILPackType>(ty)) {
30273030
for (auto packIndex : indices(packTy->getElementTypes())) {

test/IRGen/variadic_generic_types.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ blackHole(G<Int, String>.self)
3131
let g = G<Int, String, Float>()
3232
blackHole(g.makeTuple1())
3333
blackHole(g.makeTuple2())
34+
35+
struct VariadicOptionalTuple<each V> {
36+
var v: (repeat (each V)?)
37+
}
38+
39+
func useVOT(_: VariadicOptionalTuple<String>) {}

0 commit comments

Comments
 (0)