Skip to content

Commit 66b1830

Browse files
authored
Merge pull request #19561 from hamishknight/concrete-is-better-fix
[CSRanking] Amend concrete-over-protocol logic to only do an is-a check
2 parents d799578 + 8f2aadd commit 66b1830

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/Sema/CSRanking.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,10 @@ static bool isDeclAsSpecializedAs(TypeChecker &tc, DeclContext *dc,
471471
// }
472472
//
473473
if (tc.Context.isSwiftVersionAtLeast(5) && !isDynamicOverloadComparison) {
474-
auto *proto1 = dyn_cast<ProtocolDecl>(outerDC1);
475-
auto *proto2 = dyn_cast<ProtocolDecl>(outerDC2);
476-
if (proto1 != proto2)
477-
return proto2;
474+
auto inProto1 = isa<ProtocolDecl>(outerDC1);
475+
auto inProto2 = isa<ProtocolDecl>(outerDC2);
476+
if (inProto1 != inProto2)
477+
return inProto2;
478478
}
479479

480480
Type type1 = decl1->getInterfaceType();

0 commit comments

Comments
 (0)