mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ConstraintSystem] Adjust keypath subscript assert to account for dynamic member lookup
It's possible to find a suitable overload choice for key path application through keypath dynamic member lookup and assertion inside `addKeyPathApplicationRootConstraint` should account for that. Resolves: rdar://problem/56350060
This commit is contained in:
@@ -7980,9 +7980,11 @@ ConstraintSystem::addKeyPathApplicationRootConstraint(Type root, ConstraintLocat
|
||||
auto subscript = dyn_cast_or_null<SubscriptExpr>(anchor);
|
||||
if (!subscript)
|
||||
return;
|
||||
|
||||
assert(path.size() == 1 &&
|
||||
path[0].getKind() == ConstraintLocator::SubscriptMember);
|
||||
|
||||
assert((path.size() == 1 &&
|
||||
path[0].getKind() == ConstraintLocator::SubscriptMember) ||
|
||||
(path.size() == 2 &&
|
||||
path[1].getKind() == ConstraintLocator::KeyPathDynamicMember));
|
||||
auto indexTuple = dyn_cast<TupleExpr>(subscript->getIndex());
|
||||
if (!indexTuple || indexTuple->getNumElements() != 1)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user