@@ -91,7 +91,7 @@ Solution::computeSubstitutions(GenericSignature sig,
91
91
// FIXME: Retrieve the conformance from the solution itself.
92
92
return TypeChecker::conformsToProtocol (replacement, protoType,
93
93
getConstraintSystem ().DC ,
94
- ConformanceCheckFlags::InExpression );
94
+ None );
95
95
};
96
96
97
97
return SubstitutionMap::get (sig,
@@ -499,9 +499,7 @@ namespace {
499
499
// the protocol requirement with Self == the concrete type, and SILGen
500
500
// (or later) can devirtualize as appropriate.
501
501
auto conformance =
502
- TypeChecker::conformsToProtocol (
503
- baseTy, proto, cs.DC ,
504
- ConformanceCheckFlags::InExpression);
502
+ TypeChecker::conformsToProtocol (baseTy, proto, cs.DC , None);
505
503
if (conformance.isConcrete ()) {
506
504
if (auto witness = conformance.getConcrete ()->getWitnessDecl (decl)) {
507
505
bool isMemberOperator = witness->getDeclContext ()->isTypeContext ();
@@ -2137,7 +2135,7 @@ namespace {
2137
2135
= TypeChecker::conformsToProtocol (valueType,
2138
2136
bridgedProto,
2139
2137
cs.DC ,
2140
- ConformanceCheckFlags::InExpression );
2138
+ None );
2141
2139
2142
2140
FuncDecl *fn = nullptr ;
2143
2141
@@ -2397,8 +2395,7 @@ namespace {
2397
2395
ProtocolDecl *protocol = TypeChecker::getProtocol (
2398
2396
ctx, expr->getLoc (), KnownProtocolKind::ExpressibleByStringLiteral);
2399
2397
2400
- if (!TypeChecker::conformsToProtocol (
2401
- type, protocol, cs.DC , ConformanceCheckFlags::InExpression)) {
2398
+ if (!TypeChecker::conformsToProtocol (type, protocol, cs.DC , None)) {
2402
2399
// If the type does not conform to ExpressibleByStringLiteral, it should
2403
2400
// be ExpressibleByExtendedGraphemeClusterLiteral.
2404
2401
protocol = TypeChecker::getProtocol (
@@ -2407,8 +2404,7 @@ namespace {
2407
2404
isStringLiteral = false ;
2408
2405
isGraphemeClusterLiteral = true ;
2409
2406
}
2410
- if (!TypeChecker::conformsToProtocol (
2411
- type, protocol, cs.DC , ConformanceCheckFlags::InExpression)) {
2407
+ if (!TypeChecker::conformsToProtocol (type, protocol, cs.DC , None)) {
2412
2408
// ... or it should be ExpressibleByUnicodeScalarLiteral.
2413
2409
protocol = TypeChecker::getProtocol (
2414
2410
cs.getASTContext (), expr->getLoc (),
@@ -2523,8 +2519,7 @@ namespace {
2523
2519
assert (proto && " Missing string interpolation protocol?" );
2524
2520
2525
2521
auto conformance =
2526
- TypeChecker::conformsToProtocol (type, proto, cs.DC ,
2527
- ConformanceCheckFlags::InExpression);
2522
+ TypeChecker::conformsToProtocol (type, proto, cs.DC , None);
2528
2523
assert (conformance && " string interpolation type conforms to protocol" );
2529
2524
2530
2525
DeclName constrName (ctx, DeclBaseName::createConstructor (), argLabels);
@@ -2630,8 +2625,7 @@ namespace {
2630
2625
auto proto = TypeChecker::getLiteralProtocol (cs.getASTContext (), expr);
2631
2626
assert (proto && " Missing object literal protocol?" );
2632
2627
auto conformance =
2633
- TypeChecker::conformsToProtocol (conformingType, proto, cs.DC ,
2634
- ConformanceCheckFlags::InExpression);
2628
+ TypeChecker::conformsToProtocol (conformingType, proto, cs.DC , None);
2635
2629
assert (conformance && " object literal type conforms to protocol" );
2636
2630
2637
2631
auto constrName = TypeChecker::getObjectLiteralConstructorName (ctx, expr);
@@ -3336,8 +3330,7 @@ namespace {
3336
3330
assert (arrayProto && " type-checked array literal w/o protocol?!" );
3337
3331
3338
3332
auto conformance =
3339
- TypeChecker::conformsToProtocol (arrayTy, arrayProto, cs.DC ,
3340
- ConformanceCheckFlags::InExpression);
3333
+ TypeChecker::conformsToProtocol (arrayTy, arrayProto, cs.DC , None);
3341
3334
assert (conformance && " Type does not conform to protocol?" );
3342
3335
3343
3336
DeclName name (ctx, DeclBaseName::createConstructor (),
@@ -3382,7 +3375,7 @@ namespace {
3382
3375
3383
3376
auto conformance =
3384
3377
TypeChecker::conformsToProtocol (dictionaryTy, dictionaryProto, cs.DC ,
3385
- ConformanceCheckFlags::InExpression );
3378
+ None );
3386
3379
if (conformance.isInvalid ())
3387
3380
return nullptr ;
3388
3381
@@ -4121,8 +4114,7 @@ namespace {
4121
4114
// Special handle for literals conditional checked cast when they can
4122
4115
// be statically coerced to the cast type.
4123
4116
if (protocol && TypeChecker::conformsToProtocol (
4124
- toType, protocol, cs.DC ,
4125
- ConformanceCheckFlags::InExpression)) {
4117
+ toType, protocol, cs.DC , None)) {
4126
4118
ctx.Diags
4127
4119
.diagnose (expr->getLoc (),
4128
4120
diag::literal_conditional_downcast_to_coercion,
@@ -4999,8 +4991,7 @@ namespace {
4999
4991
// verified by the solver, we just need to get it again
5000
4992
// with all of the generic parameters resolved.
5001
4993
auto hashableConformance =
5002
- TypeChecker::conformsToProtocol (indexType, hashable, cs.DC ,
5003
- ConformanceCheckFlags::InExpression);
4994
+ TypeChecker::conformsToProtocol (indexType, hashable, cs.DC , None);
5004
4995
assert (hashableConformance);
5005
4996
5006
4997
conformances.push_back (hashableConformance);
@@ -5324,7 +5315,7 @@ collectExistentialConformances(Type fromType, Type toType,
5324
5315
SmallVector<ProtocolConformanceRef, 4 > conformances;
5325
5316
for (auto proto : layout.getProtocols ()) {
5326
5317
conformances.push_back (TypeChecker::containsProtocol (
5327
- fromType, proto->getDecl (), DC, ConformanceCheckFlags::InExpression ));
5318
+ fromType, proto->getDecl (), DC, None ));
5328
5319
}
5329
5320
5330
5321
return toType->getASTContext ().AllocateCopy (conformances);
@@ -6490,8 +6481,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6490
6481
auto hashable = ctx.getProtocol (KnownProtocolKind::Hashable);
6491
6482
auto conformance =
6492
6483
TypeChecker::conformsToProtocol (
6493
- cs.getType (expr), hashable, cs.DC ,
6494
- ConformanceCheckFlags::InExpression);
6484
+ cs.getType (expr), hashable, cs.DC , None);
6495
6485
assert (conformance && " must conform to Hashable" );
6496
6486
6497
6487
return cs.cacheType (
@@ -7026,7 +7016,7 @@ Expr *ExprRewriter::convertLiteralInPlace(Expr *literal,
7026
7016
// initialize via the builtin protocol.
7027
7017
if (builtinProtocol) {
7028
7018
auto builtinConformance = TypeChecker::conformsToProtocol (
7029
- type, builtinProtocol, cs.DC , ConformanceCheckFlags::InExpression );
7019
+ type, builtinProtocol, cs.DC , None );
7030
7020
if (builtinConformance) {
7031
7021
// Find the witness that we'll use to initialize the type via a builtin
7032
7022
// literal.
@@ -7058,8 +7048,7 @@ Expr *ExprRewriter::convertLiteralInPlace(Expr *literal,
7058
7048
7059
7049
// This literal type must conform to the (non-builtin) protocol.
7060
7050
assert (protocol && " requirements should have stopped recursion" );
7061
- auto conformance = TypeChecker::conformsToProtocol (type, protocol, cs.DC ,
7062
- ConformanceCheckFlags::InExpression);
7051
+ auto conformance = TypeChecker::conformsToProtocol (type, protocol, cs.DC , None);
7063
7052
assert (conformance && " must conform to literal protocol" );
7064
7053
7065
7054
// Dig out the literal type and perform a builtin literal conversion to it.
@@ -7196,8 +7185,7 @@ ExprRewriter::buildDynamicCallable(ApplyExpr *apply, SelectedOverload selected,
7196
7185
auto dictLitProto =
7197
7186
ctx.getProtocol (KnownProtocolKind::ExpressibleByDictionaryLiteral);
7198
7187
auto conformance =
7199
- TypeChecker::conformsToProtocol (argumentType, dictLitProto, cs.DC ,
7200
- ConformanceCheckFlags::InExpression);
7188
+ TypeChecker::conformsToProtocol (argumentType, dictLitProto, cs.DC , None);
7201
7189
auto keyType = conformance.getTypeWitnessByName (argumentType, ctx.Id_Key );
7202
7190
auto valueType =
7203
7191
conformance.getTypeWitnessByName (argumentType, ctx.Id_Value );
@@ -8468,8 +8456,7 @@ ProtocolConformanceRef Solution::resolveConformance(
8468
8456
// itself rather than another conforms-to-protocol check.
8469
8457
Type substConformingType = simplifyType (conformingType);
8470
8458
return TypeChecker::conformsToProtocol (
8471
- substConformingType, proto, constraintSystem->DC ,
8472
- ConformanceCheckFlags::InExpression);
8459
+ substConformingType, proto, constraintSystem->DC , None);
8473
8460
}
8474
8461
8475
8462
return ProtocolConformanceRef::forInvalid ();
0 commit comments