@@ -3323,11 +3323,11 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
33233323 SmallVector<LocatorPathElt, 4> path;
33243324 locator.getLocatorParts(path);
33253325
3326- // Find the last path element, skipping OptionalPayload elements
3326+ // Find the last path element, skipping OptionalInjection elements
33273327 // so that we allow this exception in cases of optional injection.
33283328 auto last = std::find_if(
33293329 path.rbegin(), path.rend(), [](LocatorPathElt &elt) -> bool {
3330- return elt.getKind() != ConstraintLocator::OptionalPayload ;
3330+ return elt.getKind() != ConstraintLocator::OptionalInjection ;
33313331 });
33323332
33333333 auto &ctx = getASTContext();
@@ -3431,12 +3431,12 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
34313431
34323432 // Find the last path element, skipping GenericArgument elements
34333433 // 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
34353435 // exception in cases of optional injection.
34363436 auto last = std::find_if(
34373437 path.rbegin(), path.rend(), [](LocatorPathElt &elt) -> bool {
34383438 return elt.getKind() != ConstraintLocator::GenericArgument &&
3439- elt.getKind() != ConstraintLocator::OptionalPayload ;
3439+ elt.getKind() != ConstraintLocator::OptionalInjection ;
34403440 });
34413441
34423442 if (last != path.rend()) {
@@ -3484,7 +3484,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
34843484 //
34853485 // func foo(_: ((Int, Int) -> Void)?) {}
34863486 // _ = foo { _ in } <- missing second closure parameter.
3487- if (loc->isLastElement<LocatorPathElt::OptionalPayload >()) {
3487+ if (loc->isLastElement<LocatorPathElt::OptionalInjection >()) {
34883488 auto path = loc->getPath();
34893489 loc = getConstraintLocator(loc->getAnchor(), path.drop_back());
34903490 }
@@ -4144,7 +4144,7 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
41444144 // `value-to-optional` or `optional-to-optional` conversion
41454145 // associated with them (expected argument is `AnyObject?`).
41464146 if (!path.empty() &&
4147- (path.back().is<LocatorPathElt::OptionalPayload >() ||
4147+ (path.back().is<LocatorPathElt::OptionalInjection >() ||
41484148 path.back().is<LocatorPathElt::GenericArgument>()))
41494149 path.pop_back();
41504150
@@ -4200,7 +4200,7 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
42004200 // If the path ends at `optional payload` it means that this
42014201 // check is part of an implicit value-to-optional conversion,
42024202 // and it could be safely dropped.
4203- if (!path.empty() && path.back().is<LocatorPathElt::OptionalPayload >())
4203+ if (!path.empty() && path.back().is<LocatorPathElt::OptionalInjection >())
42044204 path.pop_back();
42054205
42064206 // Determine whether this conformance mismatch is
@@ -6495,7 +6495,7 @@ bool ConstraintSystem::repairFailures(
64956495 // If the mismatch is a part of either optional-to-optional or
64966496 // value-to-optional conversions, let's allow fix refer to a complete
64976497 // top level type and not just a part of it.
6498- if (tupleLocator->findLast<LocatorPathElt::OptionalPayload >())
6498+ if (tupleLocator->findLast<LocatorPathElt::OptionalInjection >())
64996499 break;
65006500
65016501 if (tupleLocator->isForContextualType()) {
@@ -6636,7 +6636,7 @@ bool ConstraintSystem::repairFailures(
66366636 break;
66376637 }
66386638
6639- case ConstraintLocator::OptionalPayload : {
6639+ case ConstraintLocator::OptionalInjection : {
66406640 if (lhs->isPlaceholder() || rhs->isPlaceholder())
66416641 return true;
66426642
@@ -7446,7 +7446,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
74467446 // Look through all value-to-optional promotions to allow
74477447 // conversions like Double -> CGFloat?? and vice versa.
74487448 // T -> Optional<T>
7449- if (location.endsWith<LocatorPathElt::OptionalPayload >() ||
7449+ if (location.endsWith<LocatorPathElt::OptionalInjection >() ||
74507450 location.endsWith<LocatorPathElt::GenericArgument>()) {
74517451 SmallVector<LocatorPathElt, 4> path;
74527452 auto anchor = location.getLocatorParts(path);
@@ -7456,7 +7456,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
74567456 path.erase(llvm::remove_if(
74577457 path,
74587458 [](const LocatorPathElt &elt) {
7459- return elt.is<LocatorPathElt::OptionalPayload >() ||
7459+ return elt.is<LocatorPathElt::OptionalInjection >() ||
74607460 elt.is<LocatorPathElt::GenericArgument>();
74617461 }),
74627462 path.end());
@@ -14608,7 +14608,7 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
1460814608 if (generic2->getDecl()->isOptionalDecl()) {
1460914609 auto result = matchTypes(
1461014610 type1, generic2->getGenericArgs()[0], matchKind, subflags,
14611- locator.withPathElement(ConstraintLocator::OptionalPayload ));
14611+ locator.withPathElement(ConstraintLocator::OptionalInjection ));
1461214612
1461314613 if (!(shouldAttemptFixes() && result.isFailure()))
1461414614 return result;
0 commit comments