Skip to content

Commit 37fa67a

Browse files
[CSBindings] Delay key path application projected value binding until the whole constraint is considered fully bounded
1 parent f8d8091 commit 37fa67a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,25 @@ ConstraintSystem::getPotentialBindings(TypeVariableType *typeVar) const {
547547
}
548548
break;
549549
}
550+
case ConstraintKind::KeyPathApplication: {
551+
if (result.FullyBound)
552+
continue;
553+
554+
// If this variable is in the application projected result type, it is
555+
// fully bound.
556+
SmallPtrSet<TypeVariableType *, 4> typeVars;
557+
findInferableTypeVars(simplifyType(constraint->getThirdType()), typeVars);
558+
if (typeVars.count(typeVar))
559+
result.FullyBound = true;
560+
561+
break;
562+
}
550563

551564
case ConstraintKind::BridgingConversion:
552565
case ConstraintKind::CheckedCast:
553566
case ConstraintKind::EscapableFunctionOf:
554567
case ConstraintKind::OpenedExistentialOf:
555568
case ConstraintKind::KeyPath:
556-
case ConstraintKind::KeyPathApplication:
557569
case ConstraintKind::FunctionInput:
558570
case ConstraintKind::FunctionResult:
559571
case ConstraintKind::OpaqueUnderlyingType:

0 commit comments

Comments
 (0)