@@ -600,7 +600,7 @@ static Type getKeyPathType(ASTContext &ctx, KeyPathCapability capability,
600600 return keyPathTy;
601601}
602602
603- void BindingSet::finalize (
603+ bool BindingSet::finalize (
604604 llvm::SmallDenseMap<TypeVariableType *, BindingSet> &inferredBindings) {
605605 inferTransitiveBindings (inferredBindings);
606606
@@ -654,9 +654,10 @@ void BindingSet::finalize(
654654
655655 std::tie (isValid, capability) = CS.inferKeyPathLiteralCapability (TypeVar);
656656
657- // Key path literal is not yet sufficiently resolved.
657+ // Key path literal is not yet sufficiently resolved, this binding
658+ // set is not viable.
658659 if (isValid && !capability)
659- return ;
660+ return false ;
660661
661662 // If the key path is sufficiently resolved we can add inferred binding
662663 // to the set.
@@ -728,7 +729,7 @@ void BindingSet::finalize(
728729 Bindings = std::move (updatedBindings);
729730 Defaults.clear ();
730731
731- return ;
732+ return true ;
732733 }
733734
734735 if (CS.shouldAttemptFixes () &&
@@ -752,6 +753,8 @@ void BindingSet::finalize(
752753 });
753754 }
754755 }
756+
757+ return true ;
755758 }
756759}
757760
@@ -1030,7 +1033,8 @@ llvm::Optional<BindingSet> ConstraintSystem::determineBestBindings(
10301033 // produce a default type.
10311034 bool isViable = isViableForRanking (bindings);
10321035
1033- bindings.finalize (cache);
1036+ if (!bindings.finalize (cache))
1037+ continue ;
10341038
10351039 if (!bindings || !isViable)
10361040 continue ;
0 commit comments