Skip to content

Commit b0abb7f

Browse files
committed
[CSSimplify] Delay .element lookup if pack expansion is not yet resolved
1 parent d7c3208 commit b0abb7f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9177,12 +9177,18 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
91779177
if (auto baseTuple = baseObjTy->getAs<TupleType>()) {
91789178
if (!memberName.isSpecial()) {
91799179
StringRef nameStr = memberName.getBaseIdentifier().str();
9180-
91819180
// Accessing `.element` on an abstract tuple materializes a pack.
91829181
if (nameStr == "element" && baseTuple->getNumElements() == 1 &&
9183-
baseTuple->getElementType(0)->is<PackExpansionType>()) {
9184-
result.ViableCandidates.push_back(
9182+
isPackExpansionType(baseTuple->getElementType(0))) {
9183+
auto elementType = baseTuple->getElementType(0);
9184+
9185+
if (elementType->is<PackExpansionType>()) {
9186+
result.ViableCandidates.push_back(
91859187
OverloadChoice(baseTy, OverloadChoiceKind::MaterializePack));
9188+
} else {
9189+
assert(elementType->is<TypeVariableType>());
9190+
result.OverallResult = MemberLookupResult::Unsolved;
9191+
}
91869192
return result;
91879193
}
91889194

0 commit comments

Comments
 (0)