Skip to content

Commit 26c8042

Browse files
committed
Sema: Replace some getGenericParamsOfContext() calls with isGenericContext()
1 parent b4d1133 commit 26c8042

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/AST/Mangle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ void Mangler::mangleType(Type type, unsigned uncurryLevel) {
11091109
SmallVector<const void *, 4> SortedSubsts(Substitutions.size());
11101110
for (auto S : Substitutions) SortedSubsts[S.second] = S.first;
11111111
for (auto S : SortedSubsts) ContextMangler.addSubstitution(S);
1112-
while (DC && DC->getGenericParamsOfContext()) {
1112+
while (DC && DC->isGenericContext()) {
11131113
if (DC->isInnermostContextGeneric() &&
11141114
DC->getGenericParamsOfContext()->getDepth() == GTPT->getDepth())
11151115
break;

lib/Sema/CSDiag.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ static bool findGenericSubstitutions(DeclContext *dc, Type paramType,
12021202

12031203
bool mismatch(SubstitutableType *paramType, TypeBase *argType) {
12041204
Type type = paramType;
1205-
if (dc && dc->getGenericParamsOfContext() && type->isTypeParameter())
1205+
if (dc && dc->isGenericContext() && type->isTypeParameter())
12061206
type = ArchetypeBuilder::mapTypeIntoContext(dc, paramType);
12071207

12081208
if (auto archetype = type->getAs<ArchetypeType>()) {
@@ -1339,7 +1339,7 @@ CalleeCandidateInfo::evaluateCloseness(DeclContext *dc, Type candArgListType,
13391339
matchType.findIf([&](Type type) -> bool {
13401340
if (auto substitution = dyn_cast<SubstitutedType>(type.getPointer())) {
13411341
Type original = substitution->getOriginal();
1342-
if (dc && dc->getGenericParamsOfContext() && original->isTypeParameter())
1342+
if (dc && dc->isGenericContext() && original->isTypeParameter())
13431343
original = ArchetypeBuilder::mapTypeIntoContext(dc, original);
13441344

13451345
Type replacement = substitution->getReplacementType();

lib/Sema/TypeChecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static void bindExtensionDecl(ExtensionDecl *ED, TypeChecker &TC) {
366366

367367
// If the extended type is generic or is a protocol. Clone or create
368368
// the generic parameters.
369-
if (extendedNominal->getGenericParamsOfContext()) {
369+
if (extendedNominal->isGenericContext()) {
370370
if (auto proto = dyn_cast<ProtocolDecl>(extendedNominal)) {
371371
// For a protocol extension, build the generic parameter list.
372372
ED->setGenericParams(proto->createGenericParams(ED));
@@ -381,7 +381,7 @@ static void bindExtensionDecl(ExtensionDecl *ED, TypeChecker &TC) {
381381
// If we have a trailing where clause, deal with it now.
382382
// For now, trailing where clauses are only permitted on protocol extensions.
383383
if (auto trailingWhereClause = ED->getTrailingWhereClause()) {
384-
if (!extendedNominal->getGenericParamsOfContext()) {
384+
if (!extendedNominal->isGenericContext()) {
385385
// Only generic and protocol types are permitted to have
386386
// trailing where clauses.
387387
TC.diagnose(ED, diag::extension_nongeneric_trailing_where, extendedType)

0 commit comments

Comments
 (0)