Skip to content

Commit aa84dc6

Browse files
committed
Sema: Use protocol generic signature instead of requirement signature to check type witnesses
Regression was introduced by ec60c88. I don't have a reduced test case, but this solves <rdar://problem/32668454>.
1 parent 61b7eff commit aa84dc6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,17 +3291,17 @@ static CheckTypeWitnessResult checkTypeWitness(TypeChecker &tc, DeclContext *dc,
32913291
AssociatedTypeDecl *assocType,
32923292
Type type) {
32933293
auto *moduleDecl = dc->getParentModule();
3294-
auto *reqtSig = assocType->getProtocol()->getRequirementSignature();
3294+
auto *genericSig = proto->getGenericSignature();
32953295
auto *depTy = DependentMemberType::get(proto->getSelfInterfaceType(),
32963296
assocType);
32973297

3298-
if (auto superclass = reqtSig->getSuperclassBound(depTy, *moduleDecl)) {
3298+
if (auto superclass = genericSig->getSuperclassBound(depTy, *moduleDecl)) {
32993299
if (!superclass->isExactSuperclassOf(type))
33003300
return superclass->getAnyNominal();
33013301
}
33023302

33033303
// Check protocol conformances.
3304-
for (auto reqProto : reqtSig->getConformsTo(depTy, *moduleDecl)) {
3304+
for (auto reqProto : genericSig->getConformsTo(depTy, *moduleDecl)) {
33053305
if (!tc.conformsToProtocol(type, reqProto, dc, None))
33063306
return reqProto;
33073307

0 commit comments

Comments
 (0)