File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -3866,6 +3866,12 @@ namespace {
3866
3866
base = optTy;
3867
3867
}
3868
3868
3869
+ // If we have a malformed KeyPathExpr e.g. let _: KeyPath<A, C> = \A
3870
+ // let's record a AllowKeyPathMissingComponent fix.
3871
+ if (E->hasSingleInvalidComponent ()) {
3872
+ (void )CS.recordFix (AllowKeyPathWithoutComponents::create (CS, locator));
3873
+ }
3874
+
3869
3875
auto valueLocator =
3870
3876
CS.getConstraintLocator (E, ConstraintLocator::KeyPathValue);
3871
3877
auto *value = CS.createTypeVariable (valueLocator, TVO_CanBindToNoEscape |
Original file line number Diff line number Diff line change @@ -12299,13 +12299,9 @@ ConstraintSystem::simplifyKeyPathConstraint(
12299
12299
if (keyPathTy->isPlaceholder())
12300
12300
return SolutionKind::Solved;
12301
12301
12302
- // If we have a malformed KeyPathExpr e.g. let _: KeyPath<A, C> = \A
12303
- // let's record a AllowKeyPathMissingComponent fix.
12304
- if (keyPath->hasSingleInvalidComponent()) {
12305
- auto *fix = AllowKeyPathWithoutComponents::create(
12306
- *this, getConstraintLocator(locator));
12307
- return recordFix(fix) ? SolutionKind::Error : SolutionKind::Solved;
12308
- }
12302
+ if (hasFixFor(getConstraintLocator(keyPath),
12303
+ FixKind::AllowKeyPathWithoutComponents))
12304
+ return SolutionKind::Solved;
12309
12305
12310
12306
// If the root type has been bound to a hole, we cannot infer it.
12311
12307
if (getFixedTypeRecursive(rootTy, /*wantRValue*/ true)->isPlaceholder())
You can’t perform that action at this time.
0 commit comments