mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSDiagnostics] Look through l-value conversions when mismatch is in subscript setter
`repairFailures` needs a special case when l-value conversion is associated with a result type of subscript setter because otherwise it falls through and treats result type as if it's an argument type, which leads to crashes. Resolves: rdar://84580119
This commit is contained in:
@@ -4563,6 +4563,14 @@ bool ConstraintSystem::repairFailures(
|
||||
break;
|
||||
}
|
||||
|
||||
// If this is a problem with result type of a subscript setter,
|
||||
// let's re-attempt to repair without l-value conversion in the
|
||||
// locator to fix underlying type mismatch.
|
||||
if (path.back().is<LocatorPathElt::FunctionResult>()) {
|
||||
return repairFailures(lhs, rhs, matchKind, conversionsOrFixes,
|
||||
getConstraintLocator(anchor, path));
|
||||
}
|
||||
|
||||
// If this is a function type param type mismatch in any position,
|
||||
// the mismatch we want to report is for the whole structural type.
|
||||
auto last = std::find_if(
|
||||
|
||||
Reference in New Issue
Block a user