Skip to content

Commit 1a011c3

Browse files
committed
[ConstraintSystem] Adjust locator for key path project value type variable
Previous `FunctionArgument` locator didn't make sense because this type variable doesn't actually represent a parameter but rather a value generic parameter of the key path subscript index parameter.
1 parent 47b4d70 commit 1a011c3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3686,11 +3686,12 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
36863686
// Key path application looks like a subscript(keyPath: KeyPath<Base, T>).
36873687
// The element type is T or @lvalue T based on the key path subtype and
36883688
// the mutability of the base.
3689-
auto keyPathIndexTy = createTypeVariable(
3690-
getConstraintLocator(locator, ConstraintLocator::KeyPathSubscriptIndex),
3691-
/*options=*/0);
3689+
auto *keyPathIndexLoc =
3690+
getConstraintLocator(locator, ConstraintLocator::KeyPathSubscriptIndex);
3691+
auto keyPathIndexTy = createTypeVariable(keyPathIndexLoc,
3692+
/*options=*/0);
36923693
auto elementTy = createTypeVariable(
3693-
getConstraintLocator(locator, ConstraintLocator::FunctionArgument),
3694+
getConstraintLocator(keyPathIndexLoc, ConstraintLocator::KeyPathValue),
36943695
TVO_CanBindToLValue | TVO_CanBindToNoEscape);
36953696

36963697
// The element result is an lvalue or rvalue based on the key path class.

0 commit comments

Comments
 (0)