mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #26376 from xedin/rdar-53238058
[CSFix] Delay `missing unwrap` locator simplification until diagnostic
This commit is contained in:
@@ -1085,6 +1085,14 @@ bool MissingOptionalUnwrapFailure::diagnoseAsError() {
|
||||
|
||||
auto *anchor = getAnchor();
|
||||
|
||||
// If this is an unresolved member expr e.g. `.foo` its
|
||||
// base type is going to be the same as result type minus
|
||||
// r-value adjustment because base could be an l-value type.
|
||||
// We want to fix both cases by only diagnose one of them,
|
||||
// otherwise this is just going to result in a duplcate diagnostic.
|
||||
if (getLocator()->isLastElement(ConstraintLocator::UnresolvedMember))
|
||||
return false;
|
||||
|
||||
if (auto assignExpr = dyn_cast<AssignExpr>(anchor))
|
||||
anchor = assignExpr->getSrc();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user