Skip to content

Commit f9e0007

Browse files
author
Sima Nerush
committed
Record a fix about extra parens for computed properties
1 parent c8ec463 commit f9e0007

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7750,7 +7750,20 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
77507750
if (type1->isPlaceholder() || type2->isPlaceholder())
77517751
return getTypeMatchSuccess();
77527752

7753+
// If the other side is a tuple containing a pack expansion with the same
7754+
// number of elements, record a fix.
77537755
auto *loc = getConstraintLocator(locator);
7756+
if (loc->isLastElement<LocatorPathElt::ApplyArgToParam>()) {
7757+
if (auto paramPack = simplifyType(type2, flags)->getAs<PackType>()) {
7758+
if (type1->getAs<TupleType>()->getNumElements() ==
7759+
paramPack->getNumElements()) {
7760+
if (recordFix(DestructureTupleToMatchPackExpansionParameter::create(
7761+
*this, paramPack, loc))) {
7762+
return getTypeMatchFailure(loc);
7763+
}
7764+
}
7765+
}
7766+
}
77547767
if (recordFix(AllowInvalidPackExpansion::create(*this, loc)))
77557768
return getTypeMatchFailure(locator);
77567769

0 commit comments

Comments
 (0)