Skip to content

Commit d542ab9

Browse files
committed
[ConstraintSystem] Add a new locator for key path subscript parameter
1 parent 98e65d0 commit d542ab9

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

include/swift/Sema/ConstraintLocatorPathElts.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ SIMPLE_LOCATOR_PATH_ELT(KeyPathType)
131131
/// The value of a key path.
132132
SIMPLE_LOCATOR_PATH_ELT(KeyPathValue)
133133

134+
/// The index parameter of a special `subscript(keyPath: KeyPath<...>)`.
135+
SIMPLE_LOCATOR_PATH_ELT(KeyPathSubscriptIndex)
136+
134137
/// An implicit @lvalue-to-inout conversion; only valid for operator
135138
/// arguments.
136139
SIMPLE_LOCATOR_PATH_ELT(LValueConversion)

lib/Sema/ConstraintLocator.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ unsigned LocatorPathElt::getNewSummaryFlags() const {
111111
case ConstraintLocator::PackExpansionType:
112112
case ConstraintLocator::ThrownErrorType:
113113
case ConstraintLocator::FallbackType:
114+
case ConstraintLocator::KeyPathSubscriptIndex:
114115
return 0;
115116

116117
case ConstraintLocator::FunctionArgument:
@@ -528,6 +529,10 @@ void LocatorPathElt::dump(raw_ostream &out) const {
528529
case ConstraintLocator::FallbackType: {
529530
out << "fallback type";
530531
break;
532+
533+
case ConstraintLocator::KeyPathSubscriptIndex:
534+
out << "key path subscript index parameter";
535+
break;
531536
}
532537
}
533538
}

lib/Sema/ConstraintSystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6097,6 +6097,7 @@ void constraints::simplifyLocator(ASTNode &anchor,
60976097
case ConstraintLocator::OptionalPayload:
60986098
case ConstraintLocator::ImplicitlyUnwrappedDisjunctionChoice:
60996099
case ConstraintLocator::FallbackType:
6100+
case ConstraintLocator::KeyPathSubscriptIndex:
61006101
break;
61016102
}
61026103

0 commit comments

Comments
 (0)