@@ -113,8 +113,8 @@ Solution::computeSubstitutions(GenericSignature sig,
113
113
}
114
114
115
115
// FIXME: Retrieve the conformance from the solution itself.
116
- return TypeChecker::conformsToProtocol(replacement, protoType,
117
- getConstraintSystem().DC->getParentModule() );
116
+ return getConstraintSystem().DC->getParentModule()->checkConformance(
117
+ replacement, protoType );
118
118
};
119
119
120
120
return SubstitutionMap::get(sig,
@@ -565,7 +565,7 @@ namespace {
565
565
// the protocol requirement with Self == the concrete type, and SILGen
566
566
// (or later) can devirtualize as appropriate.
567
567
auto conformance =
568
- TypeChecker::conformsToProtocol(baseTy, proto, dc->getParentModule());
568
+ dc->getParentModule()->checkConformance(baseTy, proto );
569
569
if (conformance.isConcrete()) {
570
570
if (auto witness = conformance.getConcrete()->getWitnessDecl(decl)) {
571
571
bool isMemberOperator = witness->getDeclContext()->isTypeContext();
@@ -2459,9 +2459,7 @@ namespace {
2459
2459
2460
2460
// Try to find the conformance of the value type to _BridgedToObjectiveC.
2461
2461
auto bridgedToObjectiveCConformance
2462
- = TypeChecker::conformsToProtocol(valueType,
2463
- bridgedProto,
2464
- dc->getParentModule());
2462
+ = dc->getParentModule()->checkConformance(valueType, bridgedProto);
2465
2463
2466
2464
FuncDecl *fn = nullptr;
2467
2465
@@ -2722,7 +2720,7 @@ namespace {
2722
2720
ProtocolDecl *protocol = TypeChecker::getProtocol(
2723
2721
ctx, expr->getLoc(), KnownProtocolKind::ExpressibleByStringLiteral);
2724
2722
2725
- if (!TypeChecker::conformsToProtocol(type, protocol, dc->getParentModule())) {
2723
+ if (!dc->getParentModule()->checkConformance(type, protocol )) {
2726
2724
// If the type does not conform to ExpressibleByStringLiteral, it should
2727
2725
// be ExpressibleByExtendedGraphemeClusterLiteral.
2728
2726
protocol = TypeChecker::getProtocol(
@@ -2731,7 +2729,7 @@ namespace {
2731
2729
isStringLiteral = false;
2732
2730
isGraphemeClusterLiteral = true;
2733
2731
}
2734
- if (!TypeChecker::conformsToProtocol(type, protocol, dc->getParentModule())) {
2732
+ if (!dc->getParentModule()->checkConformance(type, protocol )) {
2735
2733
// ... or it should be ExpressibleByUnicodeScalarLiteral.
2736
2734
protocol = TypeChecker::getProtocol(
2737
2735
cs.getASTContext(), expr->getLoc(),
@@ -2846,7 +2844,7 @@ namespace {
2846
2844
assert(proto && "Missing string interpolation protocol?");
2847
2845
2848
2846
auto conformance =
2849
- TypeChecker::conformsToProtocol(type, proto, dc->getParentModule());
2847
+ dc->getParentModule()->checkConformance(type, proto );
2850
2848
assert(conformance && "string interpolation type conforms to protocol");
2851
2849
2852
2850
DeclName constrName(ctx, DeclBaseName::createConstructor(), argLabels);
@@ -2987,8 +2985,7 @@ namespace {
2987
2985
auto proto = TypeChecker::getLiteralProtocol(ctx, expr);
2988
2986
assert(proto && "Missing object literal protocol?");
2989
2987
auto conformance =
2990
- TypeChecker::conformsToProtocol(conformingType, proto,
2991
- dc->getParentModule());
2988
+ dc->getParentModule()->checkConformance(conformingType, proto);
2992
2989
assert(conformance && "object literal type conforms to protocol");
2993
2990
2994
2991
auto constrName = TypeChecker::getObjectLiteralConstructorName(ctx, expr);
@@ -3686,8 +3683,7 @@ namespace {
3686
3683
assert(arrayProto && "type-checked array literal w/o protocol?!");
3687
3684
3688
3685
auto conformance =
3689
- TypeChecker::conformsToProtocol(arrayTy, arrayProto,
3690
- dc->getParentModule());
3686
+ dc->getParentModule()->checkConformance(arrayTy, arrayProto);
3691
3687
assert(conformance && "Type does not conform to protocol?");
3692
3688
3693
3689
DeclName name(ctx, DeclBaseName::createConstructor(),
@@ -3733,8 +3729,7 @@ namespace {
3733
3729
KnownProtocolKind::ExpressibleByDictionaryLiteral);
3734
3730
3735
3731
auto conformance =
3736
- TypeChecker::conformsToProtocol(dictionaryTy, dictionaryProto,
3737
- dc->getParentModule());
3732
+ dc->getParentModule()->checkConformance(dictionaryTy, dictionaryProto);
3738
3733
if (conformance.isInvalid())
3739
3734
return nullptr;
3740
3735
@@ -5345,8 +5340,7 @@ namespace {
5345
5340
// verified by the solver, we just need to get it again
5346
5341
// with all of the generic parameters resolved.
5347
5342
auto hashableConformance =
5348
- TypeChecker::conformsToProtocol(indexType, hashable,
5349
- dc->getParentModule());
5343
+ dc->getParentModule()->checkConformance(indexType, hashable);
5350
5344
assert(hashableConformance);
5351
5345
5352
5346
conformances.push_back(hashableConformance);
@@ -6905,8 +6899,8 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6905
6899
// Find the conformance of the source type to Hashable.
6906
6900
auto hashable = ctx.getProtocol(KnownProtocolKind::Hashable);
6907
6901
auto conformance =
6908
- TypeChecker::conformsToProtocol (
6909
- cs.getType(expr), hashable, dc->getParentModule() );
6902
+ dc->getParentModule()->checkConformance (
6903
+ cs.getType(expr), hashable);
6910
6904
assert(conformance && "must conform to Hashable");
6911
6905
6912
6906
return cs.cacheType(
@@ -7692,8 +7686,8 @@ Expr *ExprRewriter::convertLiteralInPlace(
7692
7686
// Check whether this literal type conforms to the builtin protocol. If so,
7693
7687
// initialize via the builtin protocol.
7694
7688
if (builtinProtocol) {
7695
- auto builtinConformance = TypeChecker::conformsToProtocol (
7696
- type, builtinProtocol, dc->getParentModule() );
7689
+ auto builtinConformance = dc->getParentModule()->checkConformance (
7690
+ type, builtinProtocol);
7697
7691
if (builtinConformance) {
7698
7692
// Find the witness that we'll use to initialize the type via a builtin
7699
7693
// literal.
@@ -7716,8 +7710,7 @@ Expr *ExprRewriter::convertLiteralInPlace(
7716
7710
7717
7711
// This literal type must conform to the (non-builtin) protocol.
7718
7712
assert(protocol && "requirements should have stopped recursion");
7719
- auto conformance = TypeChecker::conformsToProtocol(type, protocol,
7720
- dc->getParentModule());
7713
+ auto conformance = dc->getParentModule()->checkConformance(type, protocol);
7721
7714
assert(conformance && "must conform to literal protocol");
7722
7715
7723
7716
// Dig out the literal type and perform a builtin literal conversion to it.
@@ -7841,8 +7834,7 @@ std::pair<Expr *, ArgumentList *> ExprRewriter::buildDynamicCallable(
7841
7834
auto dictLitProto =
7842
7835
ctx.getProtocol(KnownProtocolKind::ExpressibleByDictionaryLiteral);
7843
7836
auto conformance =
7844
- TypeChecker::conformsToProtocol(argumentType, dictLitProto,
7845
- dc->getParentModule());
7837
+ dc->getParentModule()->checkConformance(argumentType, dictLitProto);
7846
7838
auto keyType = conformance.getTypeWitnessByName(argumentType, ctx.Id_Key);
7847
7839
auto valueType =
7848
7840
conformance.getTypeWitnessByName(argumentType, ctx.Id_Value);
@@ -9192,8 +9184,8 @@ static llvm::Optional<SequenceIterationInfo> applySolutionToForEachStmt(
9192
9184
parsedSequence, LocatorPathElt::ContextualType(CTP_ForEachSequence));
9193
9185
type = Type(solution.OpenedExistentialTypes[contextualLoc]);
9194
9186
}
9195
- auto sequenceConformance = TypeChecker::conformsToProtocol (
9196
- type, sequenceProto, dc->getParentModule() );
9187
+ auto sequenceConformance = dc->getParentModule()->checkConformance (
9188
+ type, sequenceProto);
9197
9189
assert(!sequenceConformance.isInvalid() &&
9198
9190
"Couldn't find sequence conformance");
9199
9191
stmt->setSequenceConformance(sequenceConformance);
0 commit comments