Skip to content

Commit 40a7856

Browse files
committed
[CSSimplify] Don't record requirement failure if one of the sides is unresolved
1 parent 4c79b7a commit 40a7856

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
@@ -5355,6 +5355,19 @@ bool ConstraintSystem::repairFailures(
53555355
if (isFixedRequirement(reqLoc, rhs))
53565356
return true;
53575357

5358+
// If this is a requirement on sequence of for-in statement where one
5359+
// of the sides is a completely resolved dependent member, skip it
5360+
// since the issue is with the conformance to `Sequence`, otherwise
5361+
// dependent member would have been substituted.
5362+
if (auto *UDE = getAsExpr<UnresolvedDotExpr>(anchor)) {
5363+
if (UDE->isImplicit() &&
5364+
getContextualTypePurpose(UDE->getBase()) == CTP_ForEachSequence) {
5365+
if ((lhs->is<DependentMemberType>() && !lhs->hasTypeVariable()) ||
5366+
(rhs->is<DependentMemberType>() && !rhs->hasTypeVariable()))
5367+
return true;
5368+
}
5369+
}
5370+
53585371
if (auto *fix = fixRequirementFailure(*this, lhs, rhs, anchor, path)) {
53595372
recordFixedRequirement(reqLoc, rhs);
53605373
conversionsOrFixes.push_back(fix);

0 commit comments

Comments
 (0)