@@ -493,9 +493,7 @@ void BindingSet::inferTransitiveProtocolRequirements() {
493493 } while (!workList.empty ());
494494}
495495
496- void BindingSet::inferTransitiveBindings () {
497- using BindingKind = AllowedBindingKind;
498-
496+ void BindingSet::inferTransitiveKeyPathBindings () {
499497 // If the current type variable represents a key path root type
500498 // let's try to transitively infer its type through bindings of
501499 // a key path type.
@@ -550,14 +548,18 @@ void BindingSet::inferTransitiveBindings() {
550548 }
551549 } else {
552550 addBinding (
553- binding.withSameSource (inferredRootTy, BindingKind ::Exact),
551+ binding.withSameSource (inferredRootTy, AllowedBindingKind ::Exact),
554552 /* isTransitive=*/ true );
555553 }
556554 }
557555 }
558556 }
559557 }
560558 }
559+ }
560+
561+ void BindingSet::inferTransitiveBindings () {
562+ inferTransitiveKeyPathBindings ();
561563
562564 for (const auto &entry : Info.SupertypeOf ) {
563565 auto &node = CS.getConstraintGraph ()[entry.first ];
@@ -608,8 +610,8 @@ void BindingSet::inferTransitiveBindings() {
608610 // either be Exact or Supertypes in order for it to make sense
609611 // to add Supertype bindings based on the relationship between
610612 // our type variables.
611- if (binding.Kind != BindingKind ::Exact &&
612- binding.Kind != BindingKind ::Supertypes)
613+ if (binding.Kind != AllowedBindingKind ::Exact &&
614+ binding.Kind != AllowedBindingKind ::Supertypes)
613615 continue ;
614616
615617 auto type = binding.BindingType ;
@@ -620,7 +622,7 @@ void BindingSet::inferTransitiveBindings() {
620622 if (ConstraintSystem::typeVarOccursInType (TypeVar, type))
621623 continue ;
622624
623- addBinding (binding.withSameSource (type, BindingKind ::Supertypes),
625+ addBinding (binding.withSameSource (type, AllowedBindingKind ::Supertypes),
624626 /* isTransitive=*/ true );
625627 }
626628 }
0 commit comments