@@ -101,7 +101,7 @@ Solution::computeSubstitutions(GenericSignature sig,
101
101
102
102
// FIXME: Retrieve the conformance from the solution itself.
103
103
return TypeChecker::conformsToProtocol(replacement, protoType,
104
- getConstraintSystem ().DC );
104
+ getConstraintSystem().DC->getParentModule() );
105
105
};
106
106
107
107
return SubstitutionMap::get(sig,
@@ -620,7 +620,7 @@ namespace {
620
620
// the protocol requirement with Self == the concrete type, and SILGen
621
621
// (or later) can devirtualize as appropriate.
622
622
auto conformance =
623
- TypeChecker::conformsToProtocol (baseTy, proto, cs.DC );
623
+ TypeChecker::conformsToProtocol(baseTy, proto, cs.DC->getParentModule() );
624
624
if (conformance.isConcrete()) {
625
625
if (auto witness = conformance.getConcrete()->getWitnessDecl(decl)) {
626
626
bool isMemberOperator = witness->getDeclContext()->isTypeContext();
@@ -2418,7 +2418,7 @@ namespace {
2418
2418
auto bridgedToObjectiveCConformance
2419
2419
= TypeChecker::conformsToProtocol(valueType,
2420
2420
bridgedProto,
2421
- cs.DC );
2421
+ cs.DC->getParentModule() );
2422
2422
2423
2423
FuncDecl *fn = nullptr;
2424
2424
@@ -2678,7 +2678,7 @@ namespace {
2678
2678
ProtocolDecl *protocol = TypeChecker::getProtocol(
2679
2679
ctx, expr->getLoc(), KnownProtocolKind::ExpressibleByStringLiteral);
2680
2680
2681
- if (!TypeChecker::conformsToProtocol (type, protocol, cs.DC )) {
2681
+ if (!TypeChecker::conformsToProtocol(type, protocol, cs.DC->getParentModule() )) {
2682
2682
// If the type does not conform to ExpressibleByStringLiteral, it should
2683
2683
// be ExpressibleByExtendedGraphemeClusterLiteral.
2684
2684
protocol = TypeChecker::getProtocol(
@@ -2687,7 +2687,7 @@ namespace {
2687
2687
isStringLiteral = false;
2688
2688
isGraphemeClusterLiteral = true;
2689
2689
}
2690
- if (!TypeChecker::conformsToProtocol (type, protocol, cs.DC )) {
2690
+ if (!TypeChecker::conformsToProtocol(type, protocol, cs.DC->getParentModule() )) {
2691
2691
// ... or it should be ExpressibleByUnicodeScalarLiteral.
2692
2692
protocol = TypeChecker::getProtocol(
2693
2693
cs.getASTContext(), expr->getLoc(),
@@ -2802,7 +2802,7 @@ namespace {
2802
2802
assert(proto && "Missing string interpolation protocol?");
2803
2803
2804
2804
auto conformance =
2805
- TypeChecker::conformsToProtocol (type, proto, cs.DC );
2805
+ TypeChecker::conformsToProtocol(type, proto, cs.DC->getParentModule() );
2806
2806
assert(conformance && "string interpolation type conforms to protocol");
2807
2807
2808
2808
DeclName constrName(ctx, DeclBaseName::createConstructor(), argLabels);
@@ -2908,7 +2908,8 @@ namespace {
2908
2908
auto proto = TypeChecker::getLiteralProtocol(ctx, expr);
2909
2909
assert(proto && "Missing object literal protocol?");
2910
2910
auto conformance =
2911
- TypeChecker::conformsToProtocol (conformingType, proto, cs.DC );
2911
+ TypeChecker::conformsToProtocol(conformingType, proto,
2912
+ cs.DC->getParentModule());
2912
2913
assert(conformance && "object literal type conforms to protocol");
2913
2914
2914
2915
auto constrName = TypeChecker::getObjectLiteralConstructorName(ctx, expr);
@@ -3511,7 +3512,8 @@ namespace {
3511
3512
assert(arrayProto && "type-checked array literal w/o protocol?!");
3512
3513
3513
3514
auto conformance =
3514
- TypeChecker::conformsToProtocol (arrayTy, arrayProto, cs.DC );
3515
+ TypeChecker::conformsToProtocol(arrayTy, arrayProto,
3516
+ cs.DC->getParentModule());
3515
3517
assert(conformance && "Type does not conform to protocol?");
3516
3518
3517
3519
DeclName name(ctx, DeclBaseName::createConstructor(),
@@ -3555,7 +3557,8 @@ namespace {
3555
3557
KnownProtocolKind::ExpressibleByDictionaryLiteral);
3556
3558
3557
3559
auto conformance =
3558
- TypeChecker::conformsToProtocol (dictionaryTy, dictionaryProto, cs.DC );
3560
+ TypeChecker::conformsToProtocol(dictionaryTy, dictionaryProto,
3561
+ cs.DC->getParentModule());
3559
3562
if (conformance.isInvalid())
3560
3563
return nullptr;
3561
3564
@@ -4298,7 +4301,7 @@ namespace {
4298
4301
// Special handle for literals conditional checked cast when they can
4299
4302
// be statically coerced to the cast type.
4300
4303
if (protocol && TypeChecker::conformsToProtocol(
4301
- toType, protocol, cs.DC )) {
4304
+ toType, protocol, cs.DC->getParentModule() )) {
4302
4305
ctx.Diags
4303
4306
.diagnose(expr->getLoc(),
4304
4307
diag::literal_conditional_downcast_to_coercion,
@@ -5193,7 +5196,8 @@ namespace {
5193
5196
// verified by the solver, we just need to get it again
5194
5197
// with all of the generic parameters resolved.
5195
5198
auto hashableConformance =
5196
- TypeChecker::conformsToProtocol (indexType, hashable, cs.DC );
5199
+ TypeChecker::conformsToProtocol(indexType, hashable,
5200
+ cs.DC->getParentModule());
5197
5201
assert(hashableConformance);
5198
5202
5199
5203
conformances.push_back(hashableConformance);
@@ -5503,13 +5507,13 @@ Expr *ExprRewriter::coerceSuperclass(Expr *expr, Type toType) {
5503
5507
/// conformances.
5504
5508
static ArrayRef<ProtocolConformanceRef>
5505
5509
collectExistentialConformances(Type fromType, Type toType,
5506
- DeclContext *DC ) {
5510
+ ModuleDecl *module ) {
5507
5511
auto layout = toType->getExistentialLayout();
5508
5512
5509
5513
SmallVector<ProtocolConformanceRef, 4> conformances;
5510
5514
for (auto proto : layout.getProtocols()) {
5511
5515
conformances.push_back(TypeChecker::containsProtocol(
5512
- fromType, proto->getDecl (), DC ));
5516
+ fromType, proto->getDecl(), module ));
5513
5517
}
5514
5518
5515
5519
return toType->getASTContext().AllocateCopy(conformances);
@@ -5532,7 +5536,8 @@ Expr *ExprRewriter::coerceExistential(Expr *expr, Type toType) {
5532
5536
ASTContext &ctx = cs.getASTContext();
5533
5537
5534
5538
auto conformances =
5535
- collectExistentialConformances (fromInstanceType, toInstanceType, cs.DC );
5539
+ collectExistentialConformances(fromInstanceType, toInstanceType,
5540
+ cs.DC->getParentModule());
5536
5541
5537
5542
// For existential-to-existential coercions, open the source existential.
5538
5543
if (fromType->isAnyExistentialType()) {
@@ -6689,7 +6694,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6689
6694
auto hashable = ctx.getProtocol(KnownProtocolKind::Hashable);
6690
6695
auto conformance =
6691
6696
TypeChecker::conformsToProtocol(
6692
- cs.getType (expr), hashable, cs.DC );
6697
+ cs.getType(expr), hashable, cs.DC->getParentModule() );
6693
6698
assert(conformance && "must conform to Hashable");
6694
6699
6695
6700
return cs.cacheType(
@@ -7359,7 +7364,7 @@ Expr *ExprRewriter::convertLiteralInPlace(
7359
7364
// initialize via the builtin protocol.
7360
7365
if (builtinProtocol) {
7361
7366
auto builtinConformance = TypeChecker::conformsToProtocol(
7362
- type, builtinProtocol, cs.DC );
7367
+ type, builtinProtocol, cs.DC->getParentModule() );
7363
7368
if (builtinConformance) {
7364
7369
// Find the witness that we'll use to initialize the type via a builtin
7365
7370
// literal.
@@ -7382,7 +7387,8 @@ Expr *ExprRewriter::convertLiteralInPlace(
7382
7387
7383
7388
// This literal type must conform to the (non-builtin) protocol.
7384
7389
assert(protocol && "requirements should have stopped recursion");
7385
- auto conformance = TypeChecker::conformsToProtocol (type, protocol, cs.DC );
7390
+ auto conformance = TypeChecker::conformsToProtocol(type, protocol,
7391
+ cs.DC->getParentModule());
7386
7392
assert(conformance && "must conform to literal protocol");
7387
7393
7388
7394
// Dig out the literal type and perform a builtin literal conversion to it.
@@ -7510,7 +7516,8 @@ ExprRewriter::buildDynamicCallable(ApplyExpr *apply, SelectedOverload selected,
7510
7516
auto dictLitProto =
7511
7517
ctx.getProtocol(KnownProtocolKind::ExpressibleByDictionaryLiteral);
7512
7518
auto conformance =
7513
- TypeChecker::conformsToProtocol (argumentType, dictLitProto, cs.DC );
7519
+ TypeChecker::conformsToProtocol(argumentType, dictLitProto,
7520
+ cs.DC->getParentModule());
7514
7521
auto keyType = conformance.getTypeWitnessByName(argumentType, ctx.Id_Key);
7515
7522
auto valueType =
7516
7523
conformance.getTypeWitnessByName(argumentType, ctx.Id_Value);
@@ -8448,7 +8455,7 @@ static Optional<SolutionApplicationTarget> applySolutionToForEachStmt(
8448
8455
stmt->getAwaitLoc().isValid() ?
8449
8456
KnownProtocolKind::AsyncSequence : KnownProtocolKind::Sequence);
8450
8457
auto sequenceConformance = TypeChecker::conformsToProtocol(
8451
- forEachStmtInfo.sequenceType , sequenceProto, cs.DC );
8458
+ forEachStmtInfo.sequenceType, sequenceProto, cs.DC->getParentModule() );
8452
8459
assert(!sequenceConformance.isInvalid() &&
8453
8460
"Couldn't find sequence conformance");
8454
8461
0 commit comments