mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema][SR-14408] Increase the impact of missing member fix when member is on argument position
This commit is contained in:
@@ -8251,6 +8251,13 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
|
||||
if (instanceTy->isAny() || instanceTy->isAnyObject())
|
||||
impact += 5;
|
||||
|
||||
// Increasing the impact for missing member in any argument position so it
|
||||
// doesn't affect situations where there are another fixes involved.
|
||||
auto *anchorExpr = getAsExpr(locator->getAnchor());
|
||||
if (anchorExpr && isArgumentExpr(anchorExpr)) {
|
||||
impact += 5;
|
||||
}
|
||||
|
||||
if (recordFix(fix, impact))
|
||||
return SolutionKind::Error;
|
||||
|
||||
@@ -8301,7 +8308,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
|
||||
functionRefKind, locator,
|
||||
/*includeInaccessibleMembers*/ true);
|
||||
|
||||
// If uwrapped type still couldn't find anything for a given name,
|
||||
// If unwrapped type still couldn't find anything for a given name,
|
||||
// let's fallback to a "not such member" fix.
|
||||
if (result.ViableCandidates.empty() && result.UnviableCandidates.empty())
|
||||
return fixMissingMember(origBaseTy, memberTy, locator);
|
||||
|
||||
Reference in New Issue
Block a user