Skip to content

Commit 3c69f4d

Browse files
committed
[ConstraintSystem] Key path capability inference should fail if there no components
1 parent 54b5676 commit 3c69f4d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7456,6 +7456,9 @@ ConstraintSystem::inferKeyPathLiteralCapability(KeyPathExpr *keyPath) {
74567456
return std::make_pair(true, capability);
74577457
};
74587458

7459+
if (keyPath->hasSingleInvalidComponent())
7460+
return fail();
7461+
74597462
auto capability = KeyPathCapability::Writable;
74607463
for (unsigned i : indices(keyPath->getComponents())) {
74617464
auto &component = keyPath->getComponents()[i];

0 commit comments

Comments
 (0)