@@ -3323,11 +3323,11 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
3323
3323
SmallVector<LocatorPathElt, 4> path;
3324
3324
locator.getLocatorParts(path);
3325
3325
3326
- // Find the last path element, skipping OptionalPayload elements
3326
+ // Find the last path element, skipping OptionalInjection elements
3327
3327
// so that we allow this exception in cases of optional injection.
3328
3328
auto last = std::find_if(
3329
3329
path.rbegin(), path.rend(), [](LocatorPathElt &elt) -> bool {
3330
- return elt.getKind() != ConstraintLocator::OptionalPayload ;
3330
+ return elt.getKind() != ConstraintLocator::OptionalInjection ;
3331
3331
});
3332
3332
3333
3333
auto &ctx = getASTContext();
@@ -3431,12 +3431,12 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
3431
3431
3432
3432
// Find the last path element, skipping GenericArgument elements
3433
3433
// so that we allow this exception in cases of optional types, and
3434
- // skipping OptionalPayload elements so that we allow this
3434
+ // skipping OptionalInjection elements so that we allow this
3435
3435
// exception in cases of optional injection.
3436
3436
auto last = std::find_if(
3437
3437
path.rbegin(), path.rend(), [](LocatorPathElt &elt) -> bool {
3438
3438
return elt.getKind() != ConstraintLocator::GenericArgument &&
3439
- elt.getKind() != ConstraintLocator::OptionalPayload ;
3439
+ elt.getKind() != ConstraintLocator::OptionalInjection ;
3440
3440
});
3441
3441
3442
3442
if (last != path.rend()) {
@@ -3484,7 +3484,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
3484
3484
//
3485
3485
// func foo(_: ((Int, Int) -> Void)?) {}
3486
3486
// _ = foo { _ in } <- missing second closure parameter.
3487
- if (loc->isLastElement<LocatorPathElt::OptionalPayload >()) {
3487
+ if (loc->isLastElement<LocatorPathElt::OptionalInjection >()) {
3488
3488
auto path = loc->getPath();
3489
3489
loc = getConstraintLocator(loc->getAnchor(), path.drop_back());
3490
3490
}
@@ -4144,7 +4144,7 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
4144
4144
// `value-to-optional` or `optional-to-optional` conversion
4145
4145
// associated with them (expected argument is `AnyObject?`).
4146
4146
if (!path.empty() &&
4147
- (path.back().is<LocatorPathElt::OptionalPayload >() ||
4147
+ (path.back().is<LocatorPathElt::OptionalInjection >() ||
4148
4148
path.back().is<LocatorPathElt::GenericArgument>()))
4149
4149
path.pop_back();
4150
4150
@@ -4200,7 +4200,7 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
4200
4200
// If the path ends at `optional payload` it means that this
4201
4201
// check is part of an implicit value-to-optional conversion,
4202
4202
// and it could be safely dropped.
4203
- if (!path.empty() && path.back().is<LocatorPathElt::OptionalPayload >())
4203
+ if (!path.empty() && path.back().is<LocatorPathElt::OptionalInjection >())
4204
4204
path.pop_back();
4205
4205
4206
4206
// Determine whether this conformance mismatch is
@@ -6495,7 +6495,7 @@ bool ConstraintSystem::repairFailures(
6495
6495
// If the mismatch is a part of either optional-to-optional or
6496
6496
// value-to-optional conversions, let's allow fix refer to a complete
6497
6497
// top level type and not just a part of it.
6498
- if (tupleLocator->findLast<LocatorPathElt::OptionalPayload >())
6498
+ if (tupleLocator->findLast<LocatorPathElt::OptionalInjection >())
6499
6499
break;
6500
6500
6501
6501
if (tupleLocator->isForContextualType()) {
@@ -6636,7 +6636,7 @@ bool ConstraintSystem::repairFailures(
6636
6636
break;
6637
6637
}
6638
6638
6639
- case ConstraintLocator::OptionalPayload : {
6639
+ case ConstraintLocator::OptionalInjection : {
6640
6640
if (lhs->isPlaceholder() || rhs->isPlaceholder())
6641
6641
return true;
6642
6642
@@ -7446,7 +7446,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
7446
7446
// Look through all value-to-optional promotions to allow
7447
7447
// conversions like Double -> CGFloat?? and vice versa.
7448
7448
// T -> Optional<T>
7449
- if (location.endsWith<LocatorPathElt::OptionalPayload >() ||
7449
+ if (location.endsWith<LocatorPathElt::OptionalInjection >() ||
7450
7450
location.endsWith<LocatorPathElt::GenericArgument>()) {
7451
7451
SmallVector<LocatorPathElt, 4> path;
7452
7452
auto anchor = location.getLocatorParts(path);
@@ -7456,7 +7456,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
7456
7456
path.erase(llvm::remove_if(
7457
7457
path,
7458
7458
[](const LocatorPathElt &elt) {
7459
- return elt.is<LocatorPathElt::OptionalPayload >() ||
7459
+ return elt.is<LocatorPathElt::OptionalInjection >() ||
7460
7460
elt.is<LocatorPathElt::GenericArgument>();
7461
7461
}),
7462
7462
path.end());
@@ -14608,7 +14608,7 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
14608
14608
if (generic2->getDecl()->isOptionalDecl()) {
14609
14609
auto result = matchTypes(
14610
14610
type1, generic2->getGenericArgs()[0], matchKind, subflags,
14611
- locator.withPathElement(ConstraintLocator::OptionalPayload ));
14611
+ locator.withPathElement(ConstraintLocator::OptionalInjection ));
14612
14612
14613
14613
if (!(shouldAttemptFixes() && result.isFailure()))
14614
14614
return result;
0 commit comments