We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe3216a commit ba7524dCopy full SHA for ba7524d
lib/Sema/CSBindings.cpp
@@ -1851,6 +1851,15 @@ TypeVariableBinding::fixForHole(ConstraintSystem &cs) const {
1851
if (cs.hasFixFor(kpLocator, FixKind::AllowKeyPathWithoutComponents))
1852
return None;
1853
1854
+ // If key path has any invalid component, let's just skip fix because the
1855
+ // invalid component would be already diagnosed.
1856
+ auto keyPath = castToExpr<KeyPathExpr>(srcLocator->getAnchor());
1857
+ if (llvm::any_of(keyPath->getComponents(),
1858
+ [](KeyPathExpr::Component component) {
1859
+ return !component.isValid();
1860
+ }))
1861
+ return None;
1862
+
1863
ConstraintFix *fix = SpecifyKeyPathRootType::create(cs, dstLocator);
1864
return std::make_pair(fix, defaultImpact);
1865
}
0 commit comments