Skip to content

5.9: [TypeLowering] NFC: Fix lexicality verification for packs and tuples. #64884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/SIL/IR/TypeLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2758,16 +2758,16 @@ bool TypeConverter::visitAggregateLeaves(
packIndex);
}
} else if (auto tupleTy = ty->getAs<TupleType>()) {
for (unsigned tupleIndex = 0, num = tupleTy->getNumElements();
tupleIndex < num; ++tupleIndex) {
auto origElementTy = origTy.getTupleElementType(tupleIndex);
auto substElementTy =
tupleTy->getElementType(tupleIndex)->getCanonicalType();
substElementTy =
computeLoweredRValueType(context, origElementTy, substElementTy);
insertIntoWorklist(substElementTy, origElementTy, nullptr,
tupleIndex);
}
unsigned tupleIndex = 0;
origTy.forEachExpandedTupleElement(
CanTupleType(tupleTy),
[&](auto origElementTy, auto substElementTy, auto element) {
substElementTy =
substOpaqueTypesWithUnderlyingTypes(substElementTy, context);
insertIntoWorklist(substElementTy, origElementTy, nullptr,
tupleIndex);
++tupleIndex;
});
} else if (auto *decl = ty->getStructOrBoundGenericStruct()) {
for (auto *structField : decl->getStoredProperties()) {
auto subMap = ty->getContextSubstitutionMap(&M, decl);
Expand Down
8 changes: 8 additions & 0 deletions test/SILGen/variadic-generic-tuples.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ func callVariadicMemberwiseInit() -> MemberwiseTupleHolder<Int, String> {
return MemberwiseTupleHolder(content: (0, "hello"))
}

@_eagerMove struct MyString {
var guts: AnyObject
}

func callVariadicMemberwiseInit(_ ms: MyString) -> MemberwiseTupleHolder<Int, MyString> {
return MemberwiseTupleHolder(content: (0, ms))
}

// rdar://107151145: when we tuple-destructure a black hole
// initialization, the resulting element initializations need to
// handle pack expansion initialization
Expand Down