File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,11 @@ void ConstraintSystem::inferTransitiveSupertypeBindings(
81
81
bindings.addPotentialBinding (
82
82
binding.withSameSource (type, AllowedBindingKind::Supertypes));
83
83
}
84
+
85
+ // Infer transitive protocol requirements.
86
+ for (auto *protocol : relatedBindings->getSecond ().Protocols ) {
87
+ bindings.Protocols .push_back (protocol);
88
+ }
84
89
}
85
90
}
86
91
@@ -628,6 +633,10 @@ ConstraintSystem::getPotentialBindings(TypeVariableType *typeVar) const {
628
633
LLVM_FALLTHROUGH;
629
634
630
635
case ConstraintKind::LiteralConformsTo: {
636
+ // Record constraint where protocol requirement originated
637
+ // this is useful to use for the binding later.
638
+ result.Protocols .push_back (constraint);
639
+
631
640
// If there is a 'nil' literal constraint, we might need optional
632
641
// supertype bindings.
633
642
if (constraint->getProtocol ()->isSpecificProtocol (
Original file line number Diff line number Diff line change @@ -4420,6 +4420,9 @@ class ConstraintSystem {
4420
4420
// / The set of potential bindings.
4421
4421
SmallVector<PotentialBinding, 4 > Bindings;
4422
4422
4423
+ // / The set of protocol requirements placed on this type variable.
4424
+ llvm::TinyPtrVector<Constraint *> Protocols;
4425
+
4423
4426
// / Whether these bindings should be delayed until the rest of the
4424
4427
// / constraint system is considered "fully bound".
4425
4428
bool FullyBound = false ;
You can’t perform that action at this time.
0 commit comments