@@ -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,
@@ -494,9 +494,7 @@ namespace {
494
494
// the protocol requirement with Self == the concrete type, and SILGen
495
495
// (or later) can devirtualize as appropriate.
496
496
auto conformance =
497
- TypeChecker::conformsToProtocol (
498
- baseTy, proto, cs.DC ,
499
- ConformanceCheckFlags::InExpression);
497
+ TypeChecker::conformsToProtocol (baseTy, proto, cs.DC , None);
500
498
if (conformance.isConcrete ()) {
501
499
if (auto witness = conformance.getConcrete ()->getWitnessDecl (decl)) {
502
500
bool isMemberOperator = witness->getDeclContext ()->isTypeContext ();
@@ -2141,7 +2139,7 @@ namespace {
2141
2139
= TypeChecker::conformsToProtocol (valueType,
2142
2140
bridgedProto,
2143
2141
cs.DC ,
2144
- ConformanceCheckFlags::InExpression );
2142
+ None );
2145
2143
2146
2144
FuncDecl *fn = nullptr ;
2147
2145
@@ -2401,8 +2399,7 @@ namespace {
2401
2399
ProtocolDecl *protocol = TypeChecker::getProtocol (
2402
2400
ctx, expr->getLoc (), KnownProtocolKind::ExpressibleByStringLiteral);
2403
2401
2404
- if (!TypeChecker::conformsToProtocol (
2405
- type, protocol, cs.DC , ConformanceCheckFlags::InExpression)) {
2402
+ if (!TypeChecker::conformsToProtocol (type, protocol, cs.DC , None)) {
2406
2403
// If the type does not conform to ExpressibleByStringLiteral, it should
2407
2404
// be ExpressibleByExtendedGraphemeClusterLiteral.
2408
2405
protocol = TypeChecker::getProtocol (
@@ -2411,8 +2408,7 @@ namespace {
2411
2408
isStringLiteral = false ;
2412
2409
isGraphemeClusterLiteral = true ;
2413
2410
}
2414
- if (!TypeChecker::conformsToProtocol (
2415
- type, protocol, cs.DC , ConformanceCheckFlags::InExpression)) {
2411
+ if (!TypeChecker::conformsToProtocol (type, protocol, cs.DC , None)) {
2416
2412
// ... or it should be ExpressibleByUnicodeScalarLiteral.
2417
2413
protocol = TypeChecker::getProtocol (
2418
2414
cs.getASTContext (), expr->getLoc (),
@@ -2527,8 +2523,7 @@ namespace {
2527
2523
assert (proto && " Missing string interpolation protocol?" );
2528
2524
2529
2525
auto conformance =
2530
- TypeChecker::conformsToProtocol (type, proto, cs.DC ,
2531
- ConformanceCheckFlags::InExpression);
2526
+ TypeChecker::conformsToProtocol (type, proto, cs.DC , None);
2532
2527
assert (conformance && " string interpolation type conforms to protocol" );
2533
2528
2534
2529
DeclName constrName (ctx, DeclBaseName::createConstructor (), argLabels);
@@ -2634,8 +2629,7 @@ namespace {
2634
2629
auto proto = TypeChecker::getLiteralProtocol (cs.getASTContext (), expr);
2635
2630
assert (proto && " Missing object literal protocol?" );
2636
2631
auto conformance =
2637
- TypeChecker::conformsToProtocol (conformingType, proto, cs.DC ,
2638
- ConformanceCheckFlags::InExpression);
2632
+ TypeChecker::conformsToProtocol (conformingType, proto, cs.DC , None);
2639
2633
assert (conformance && " object literal type conforms to protocol" );
2640
2634
2641
2635
auto constrName = TypeChecker::getObjectLiteralConstructorName (ctx, expr);
@@ -3343,8 +3337,7 @@ namespace {
3343
3337
assert (arrayProto && " type-checked array literal w/o protocol?!" );
3344
3338
3345
3339
auto conformance =
3346
- TypeChecker::conformsToProtocol (arrayTy, arrayProto, cs.DC ,
3347
- ConformanceCheckFlags::InExpression);
3340
+ TypeChecker::conformsToProtocol (arrayTy, arrayProto, cs.DC , None);
3348
3341
assert (conformance && " Type does not conform to protocol?" );
3349
3342
3350
3343
DeclName name (ctx, DeclBaseName::createConstructor (),
@@ -3389,7 +3382,7 @@ namespace {
3389
3382
3390
3383
auto conformance =
3391
3384
TypeChecker::conformsToProtocol (dictionaryTy, dictionaryProto, cs.DC ,
3392
- ConformanceCheckFlags::InExpression );
3385
+ None );
3393
3386
if (conformance.isInvalid ())
3394
3387
return nullptr ;
3395
3388
@@ -4128,8 +4121,7 @@ namespace {
4128
4121
// Special handle for literals conditional checked cast when they can
4129
4122
// be statically coerced to the cast type.
4130
4123
if (protocol && TypeChecker::conformsToProtocol (
4131
- toType, protocol, cs.DC ,
4132
- ConformanceCheckFlags::InExpression)) {
4124
+ toType, protocol, cs.DC , None)) {
4133
4125
ctx.Diags
4134
4126
.diagnose (expr->getLoc (),
4135
4127
diag::literal_conditional_downcast_to_coercion,
@@ -5006,8 +4998,7 @@ namespace {
5006
4998
// verified by the solver, we just need to get it again
5007
4999
// with all of the generic parameters resolved.
5008
5000
auto hashableConformance =
5009
- TypeChecker::conformsToProtocol (indexType, hashable, cs.DC ,
5010
- ConformanceCheckFlags::InExpression);
5001
+ TypeChecker::conformsToProtocol (indexType, hashable, cs.DC , None);
5011
5002
assert (hashableConformance);
5012
5003
5013
5004
conformances.push_back (hashableConformance);
@@ -5331,7 +5322,7 @@ collectExistentialConformances(Type fromType, Type toType,
5331
5322
SmallVector<ProtocolConformanceRef, 4 > conformances;
5332
5323
for (auto proto : layout.getProtocols ()) {
5333
5324
conformances.push_back (TypeChecker::containsProtocol (
5334
- fromType, proto->getDecl (), DC, ConformanceCheckFlags::InExpression ));
5325
+ fromType, proto->getDecl (), DC, None ));
5335
5326
}
5336
5327
5337
5328
return toType->getASTContext ().AllocateCopy (conformances);
@@ -6497,8 +6488,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6497
6488
auto hashable = ctx.getProtocol (KnownProtocolKind::Hashable);
6498
6489
auto conformance =
6499
6490
TypeChecker::conformsToProtocol (
6500
- cs.getType (expr), hashable, cs.DC ,
6501
- ConformanceCheckFlags::InExpression);
6491
+ cs.getType (expr), hashable, cs.DC , None);
6502
6492
assert (conformance && " must conform to Hashable" );
6503
6493
6504
6494
return cs.cacheType (
@@ -7033,7 +7023,7 @@ Expr *ExprRewriter::convertLiteralInPlace(Expr *literal,
7033
7023
// initialize via the builtin protocol.
7034
7024
if (builtinProtocol) {
7035
7025
auto builtinConformance = TypeChecker::conformsToProtocol (
7036
- type, builtinProtocol, cs.DC , ConformanceCheckFlags::InExpression );
7026
+ type, builtinProtocol, cs.DC , None );
7037
7027
if (builtinConformance) {
7038
7028
// Find the witness that we'll use to initialize the type via a builtin
7039
7029
// literal.
@@ -7065,8 +7055,7 @@ Expr *ExprRewriter::convertLiteralInPlace(Expr *literal,
7065
7055
7066
7056
// This literal type must conform to the (non-builtin) protocol.
7067
7057
assert (protocol && " requirements should have stopped recursion" );
7068
- auto conformance = TypeChecker::conformsToProtocol (type, protocol, cs.DC ,
7069
- ConformanceCheckFlags::InExpression);
7058
+ auto conformance = TypeChecker::conformsToProtocol (type, protocol, cs.DC , None);
7070
7059
assert (conformance && " must conform to literal protocol" );
7071
7060
7072
7061
// Dig out the literal type and perform a builtin literal conversion to it.
@@ -7187,8 +7176,7 @@ ExprRewriter::finishApplyDynamicCallable(ApplyExpr *apply,
7187
7176
auto dictLitProto =
7188
7177
ctx.getProtocol (KnownProtocolKind::ExpressibleByDictionaryLiteral);
7189
7178
auto conformance =
7190
- TypeChecker::conformsToProtocol (argumentType, dictLitProto, cs.DC ,
7191
- ConformanceCheckFlags::InExpression);
7179
+ TypeChecker::conformsToProtocol (argumentType, dictLitProto, cs.DC , None);
7192
7180
auto keyType = conformance.getTypeWitnessByName (argumentType, ctx.Id_Key );
7193
7181
auto valueType =
7194
7182
conformance.getTypeWitnessByName (argumentType, ctx.Id_Value );
@@ -8464,8 +8452,7 @@ ProtocolConformanceRef Solution::resolveConformance(
8464
8452
// itself rather than another conforms-to-protocol check.
8465
8453
Type substConformingType = simplifyType (conformingType);
8466
8454
return TypeChecker::conformsToProtocol (
8467
- substConformingType, proto, constraintSystem->DC ,
8468
- ConformanceCheckFlags::InExpression);
8455
+ substConformingType, proto, constraintSystem->DC , None);
8469
8456
}
8470
8457
8471
8458
return ProtocolConformanceRef::forInvalid ();
0 commit comments