Skip to content

Commit d7ce517

Browse files
committed
Sema: Replace a couple of TypeChecker::getProtocol() calls with ASTContext::getProtocol()
1 parent 96ee57b commit d7ce517

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8857,8 +8857,7 @@ static CheckedCastKind getCheckedCastKind(ConstraintSystem *cs,
88578857
static bool isCastToExpressibleByNilLiteral(ConstraintSystem &cs, Type fromType,
88588858
Type toType) {
88598859
auto &ctx = cs.getASTContext();
8860-
auto *nilLiteral = TypeChecker::getProtocol(
8861-
ctx, SourceLoc(), KnownProtocolKind::ExpressibleByNilLiteral);
8860+
auto *nilLiteral = ctx.getProtocol(KnownProtocolKind::ExpressibleByNilLiteral);
88628861
if (!nilLiteral)
88638862
return false;
88648863

lib/Sema/ConstraintSystem.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,8 +2037,7 @@ TypeVariableType *ConstraintSystem::openGenericParameter(
20372037
// been loaded because you've passed `-parse-stdlib` and are not building the
20382038
// stdlib itself (which would have `-module-name Swift` too).
20392039
if (!outerDC->getParentModule()->isBuiltinModule()) {
2040-
if (auto *copyable = TypeChecker::getProtocol(getASTContext(), SourceLoc(),
2041-
KnownProtocolKind::Copyable)) {
2040+
if (auto *copyable = getASTContext().getProtocol(KnownProtocolKind::Copyable)) {
20422041
addConstraint(
20432042
ConstraintKind::ConformsTo, typeVar,
20442043
copyable->getDeclaredInterfaceType(),

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5823,8 +5823,7 @@ TypeChecker::containsProtocol(Type T, ProtocolDecl *Proto, ModuleDecl *M,
58235823
bool TypeChecker::conformsToKnownProtocol(
58245824
Type type, KnownProtocolKind protocol, ModuleDecl *module,
58255825
bool allowMissing) {
5826-
if (auto *proto =
5827-
TypeChecker::getProtocol(module->getASTContext(), SourceLoc(), protocol))
5826+
if (auto *proto = module->getASTContext().getProtocol(protocol))
58285827
return (bool) module->checkConformance(type, proto, allowMissing);
58295828
return false;
58305829
}

0 commit comments

Comments
 (0)