mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #39831 from hborla/invalid-selector-property
[ConstraintSystem] Don't increase the score for unapplied function references if the expression is an argument to `#selector`.
This commit is contained in:
@@ -3000,7 +3000,13 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
|
||||
}
|
||||
|
||||
if (isa<AbstractFunctionDecl>(decl) || isa<TypeDecl>(decl)) {
|
||||
if (choice.getFunctionRefKind() == FunctionRefKind::Unapplied) {
|
||||
auto anchor = locator->getAnchor();
|
||||
// TODO: Instead of not increasing the score for arguments to #selector,
|
||||
// a better fix for this is to port over the #selector diagnostics from
|
||||
// CSApply to constraint fixes, and not attempt invalid disjunction
|
||||
// choices based on the selector kind on the valid code path.
|
||||
if (choice.getFunctionRefKind() == FunctionRefKind::Unapplied &&
|
||||
!UnevaluatedRootExprs.contains(getAsExpr(anchor))) {
|
||||
increaseScore(SK_UnappliedFunction);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user