@@ -90,8 +90,7 @@ Solution::computeSubstitutions(GenericSignature sig,
90
90
91
91
// FIXME: Retrieve the conformance from the solution itself.
92
92
return TypeChecker::conformsToProtocol (replacement, protoType,
93
- getConstraintSystem ().DC ,
94
- None);
93
+ getConstraintSystem ().DC );
95
94
};
96
95
97
96
return SubstitutionMap::get (sig,
@@ -414,7 +413,7 @@ namespace {
414
413
415
414
return SubstitutionMap::get (sig,
416
415
QueryTypeSubstitutionMap{subs},
417
- TypeChecker::LookUpConformance (cs.DC ));
416
+ LookUpConformanceInModule (cs.DC -> getParentModule () ));
418
417
}
419
418
420
419
public:
@@ -447,7 +446,7 @@ namespace {
447
446
// the protocol requirement with Self == the concrete type, and SILGen
448
447
// (or later) can devirtualize as appropriate.
449
448
auto conformance =
450
- TypeChecker::conformsToProtocol (baseTy, proto, cs.DC , None );
449
+ TypeChecker::conformsToProtocol (baseTy, proto, cs.DC );
451
450
if (conformance.isConcrete ()) {
452
451
if (auto witness = conformance.getConcrete ()->getWitnessDecl (decl)) {
453
452
bool isMemberOperator = witness->getDeclContext ()->isTypeContext ();
@@ -2082,8 +2081,7 @@ namespace {
2082
2081
auto bridgedToObjectiveCConformance
2083
2082
= TypeChecker::conformsToProtocol (valueType,
2084
2083
bridgedProto,
2085
- cs.DC ,
2086
- None);
2084
+ cs.DC );
2087
2085
2088
2086
FuncDecl *fn = nullptr ;
2089
2087
@@ -2343,7 +2341,7 @@ namespace {
2343
2341
ProtocolDecl *protocol = TypeChecker::getProtocol (
2344
2342
ctx, expr->getLoc (), KnownProtocolKind::ExpressibleByStringLiteral);
2345
2343
2346
- if (!TypeChecker::conformsToProtocol (type, protocol, cs.DC , None )) {
2344
+ if (!TypeChecker::conformsToProtocol (type, protocol, cs.DC )) {
2347
2345
// If the type does not conform to ExpressibleByStringLiteral, it should
2348
2346
// be ExpressibleByExtendedGraphemeClusterLiteral.
2349
2347
protocol = TypeChecker::getProtocol (
@@ -2352,7 +2350,7 @@ namespace {
2352
2350
isStringLiteral = false ;
2353
2351
isGraphemeClusterLiteral = true ;
2354
2352
}
2355
- if (!TypeChecker::conformsToProtocol (type, protocol, cs.DC , None )) {
2353
+ if (!TypeChecker::conformsToProtocol (type, protocol, cs.DC )) {
2356
2354
// ... or it should be ExpressibleByUnicodeScalarLiteral.
2357
2355
protocol = TypeChecker::getProtocol (
2358
2356
cs.getASTContext (), expr->getLoc (),
@@ -2467,7 +2465,7 @@ namespace {
2467
2465
assert (proto && " Missing string interpolation protocol?" );
2468
2466
2469
2467
auto conformance =
2470
- TypeChecker::conformsToProtocol (type, proto, cs.DC , None );
2468
+ TypeChecker::conformsToProtocol (type, proto, cs.DC );
2471
2469
assert (conformance && " string interpolation type conforms to protocol" );
2472
2470
2473
2471
DeclName constrName (ctx, DeclBaseName::createConstructor (), argLabels);
@@ -2573,7 +2571,7 @@ namespace {
2573
2571
auto proto = TypeChecker::getLiteralProtocol (cs.getASTContext (), expr);
2574
2572
assert (proto && " Missing object literal protocol?" );
2575
2573
auto conformance =
2576
- TypeChecker::conformsToProtocol (conformingType, proto, cs.DC , None );
2574
+ TypeChecker::conformsToProtocol (conformingType, proto, cs.DC );
2577
2575
assert (conformance && " object literal type conforms to protocol" );
2578
2576
2579
2577
auto constrName = TypeChecker::getObjectLiteralConstructorName (ctx, expr);
@@ -3278,7 +3276,7 @@ namespace {
3278
3276
assert (arrayProto && " type-checked array literal w/o protocol?!" );
3279
3277
3280
3278
auto conformance =
3281
- TypeChecker::conformsToProtocol (arrayTy, arrayProto, cs.DC , None );
3279
+ TypeChecker::conformsToProtocol (arrayTy, arrayProto, cs.DC );
3282
3280
assert (conformance && " Type does not conform to protocol?" );
3283
3281
3284
3282
DeclName name (ctx, DeclBaseName::createConstructor (),
@@ -3322,8 +3320,7 @@ namespace {
3322
3320
KnownProtocolKind::ExpressibleByDictionaryLiteral);
3323
3321
3324
3322
auto conformance =
3325
- TypeChecker::conformsToProtocol (dictionaryTy, dictionaryProto, cs.DC ,
3326
- None);
3323
+ TypeChecker::conformsToProtocol (dictionaryTy, dictionaryProto, cs.DC );
3327
3324
if (conformance.isInvalid ())
3328
3325
return nullptr ;
3329
3326
@@ -4062,7 +4059,7 @@ namespace {
4062
4059
// Special handle for literals conditional checked cast when they can
4063
4060
// be statically coerced to the cast type.
4064
4061
if (protocol && TypeChecker::conformsToProtocol (
4065
- toType, protocol, cs.DC , None )) {
4062
+ toType, protocol, cs.DC )) {
4066
4063
ctx.Diags
4067
4064
.diagnose (expr->getLoc (),
4068
4065
diag::literal_conditional_downcast_to_coercion,
@@ -4939,7 +4936,7 @@ namespace {
4939
4936
// verified by the solver, we just need to get it again
4940
4937
// with all of the generic parameters resolved.
4941
4938
auto hashableConformance =
4942
- TypeChecker::conformsToProtocol (indexType, hashable, cs.DC , None );
4939
+ TypeChecker::conformsToProtocol (indexType, hashable, cs.DC );
4943
4940
assert (hashableConformance);
4944
4941
4945
4942
conformances.push_back (hashableConformance);
@@ -5263,7 +5260,7 @@ collectExistentialConformances(Type fromType, Type toType,
5263
5260
SmallVector<ProtocolConformanceRef, 4 > conformances;
5264
5261
for (auto proto : layout.getProtocols ()) {
5265
5262
conformances.push_back (TypeChecker::containsProtocol (
5266
- fromType, proto->getDecl (), DC, None ));
5263
+ fromType, proto->getDecl (), DC));
5267
5264
}
5268
5265
5269
5266
return toType->getASTContext ().AllocateCopy (conformances);
@@ -6430,7 +6427,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6430
6427
auto hashable = ctx.getProtocol (KnownProtocolKind::Hashable);
6431
6428
auto conformance =
6432
6429
TypeChecker::conformsToProtocol (
6433
- cs.getType (expr), hashable, cs.DC , None );
6430
+ cs.getType (expr), hashable, cs.DC );
6434
6431
assert (conformance && " must conform to Hashable" );
6435
6432
6436
6433
return cs.cacheType (
@@ -6965,7 +6962,7 @@ Expr *ExprRewriter::convertLiteralInPlace(Expr *literal,
6965
6962
// initialize via the builtin protocol.
6966
6963
if (builtinProtocol) {
6967
6964
auto builtinConformance = TypeChecker::conformsToProtocol (
6968
- type, builtinProtocol, cs.DC , None );
6965
+ type, builtinProtocol, cs.DC );
6969
6966
if (builtinConformance) {
6970
6967
// Find the witness that we'll use to initialize the type via a builtin
6971
6968
// literal.
@@ -6997,7 +6994,7 @@ Expr *ExprRewriter::convertLiteralInPlace(Expr *literal,
6997
6994
6998
6995
// This literal type must conform to the (non-builtin) protocol.
6999
6996
assert (protocol && " requirements should have stopped recursion" );
7000
- auto conformance = TypeChecker::conformsToProtocol (type, protocol, cs.DC , None );
6997
+ auto conformance = TypeChecker::conformsToProtocol (type, protocol, cs.DC );
7001
6998
assert (conformance && " must conform to literal protocol" );
7002
6999
7003
7000
// Dig out the literal type and perform a builtin literal conversion to it.
@@ -7134,7 +7131,7 @@ ExprRewriter::buildDynamicCallable(ApplyExpr *apply, SelectedOverload selected,
7134
7131
auto dictLitProto =
7135
7132
ctx.getProtocol (KnownProtocolKind::ExpressibleByDictionaryLiteral);
7136
7133
auto conformance =
7137
- TypeChecker::conformsToProtocol (argumentType, dictLitProto, cs.DC , None );
7134
+ TypeChecker::conformsToProtocol (argumentType, dictLitProto, cs.DC );
7138
7135
auto keyType = conformance.getTypeWitnessByName (argumentType, ctx.Id_Key );
7139
7136
auto valueType =
7140
7137
conformance.getTypeWitnessByName (argumentType, ctx.Id_Value );
@@ -8406,7 +8403,7 @@ ProtocolConformanceRef Solution::resolveConformance(
8406
8403
// itself rather than another conforms-to-protocol check.
8407
8404
Type substConformingType = simplifyType (conformingType);
8408
8405
return TypeChecker::conformsToProtocol (
8409
- substConformingType, proto, constraintSystem->DC , None );
8406
+ substConformingType, proto, constraintSystem->DC );
8410
8407
}
8411
8408
8412
8409
return ProtocolConformanceRef::forInvalid ();
0 commit comments