mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSSimplify] Detect and diagnose invalid arguments for key path subscript
This commit is contained in:
@@ -12415,8 +12415,17 @@ ConstraintSystem::simplifyKeyPathApplicationConstraint(
|
||||
// Otherwise, we don't have a key path type at all.
|
||||
return SolutionKind::Error;
|
||||
}
|
||||
if (!keyPathTy->isTypeVariableOrMember())
|
||||
|
||||
if (!keyPathTy->isTypeVariableOrMember()) {
|
||||
if (shouldAttemptFixes()) {
|
||||
auto *fix = IgnoreKeyPathSubscriptIndexMismatch::create(
|
||||
*this, keyPathTy, getConstraintLocator(locator));
|
||||
recordAnyTypeVarAsPotentialHole(valueTy);
|
||||
return recordFix(fix) ? SolutionKind::Error : SolutionKind::Solved;
|
||||
}
|
||||
|
||||
return SolutionKind::Error;
|
||||
}
|
||||
|
||||
return unsolved();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user