Skip to content

Commit e1ad307

Browse files
committed
[Diagnostics] NFC: refactor getRequirementDC to use getGenericSignatureOfContext
1 parent 1ea3ebc commit e1ad307

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,11 @@ const DeclContext *RequirementFailure::getRequirementDC() const {
107107
auto *DC = AffectedDecl->getDeclContext();
108108

109109
do {
110-
auto *D = DC->getInnermostDeclarationDeclContext();
111-
if (!D)
112-
break;
113-
114-
if (auto *GC = D->getAsGenericContext()) {
115-
auto *sig = GC->getGenericSignature();
116-
if (sig && sig->isRequirementSatisfied(req))
110+
if (auto *sig = DC->getGenericSignatureOfContext()) {
111+
if (sig->isRequirementSatisfied(req))
117112
return DC;
118113
}
119-
120-
DC = DC->getParent();
121-
} while (DC);
114+
} while ((DC = DC->getParent()));
122115

123116
return AffectedDecl->getAsGenericContext();
124117
}

0 commit comments

Comments
 (0)