Skip to content

Commit 17f7ad8

Browse files
committed
[CSBindings] Record all of the protocol requirements (not just literal)
1 parent faa6289 commit 17f7ad8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4706,7 +4706,7 @@ class ConstraintSystem {
47064706
SmallVector<PotentialBinding, 4> Bindings;
47074707

47084708
/// The set of protocol requirements placed on this type variable.
4709-
llvm::TinyPtrVector<Constraint *> Protocols;
4709+
llvm::SmallVector<Constraint *, 4> Protocols;
47104710

47114711
/// The set of constraints which would be used to infer default types.
47124712
llvm::TinyPtrVector<Constraint *> Defaults;

lib/Sema/CSBindings.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,8 +986,13 @@ bool ConstraintSystem::PotentialBindings::infer(
986986
break;
987987

988988
case ConstraintKind::ConformsTo:
989-
case ConstraintKind::SelfObjectOfProtocol:
990-
return false;
989+
case ConstraintKind::SelfObjectOfProtocol: {
990+
auto protocolTy = constraint->getSecondType();
991+
if (!protocolTy->is<ProtocolType>())
992+
return false;
993+
994+
LLVM_FALLTHROUGH;
995+
}
991996

992997
case ConstraintKind::LiteralConformsTo: {
993998
// Record constraint where protocol requirement originated

0 commit comments

Comments
 (0)