[ConstraintSystem] Don't increase the score for unapplied function references

if the expression is an argument to `#selector`.

For `#selector` arguments, functions and properties are syntactically distinct
with the getter/setter label, so the solver should not unconditionally prefer
properties to unapplied functions. A better fix for this is to port over the
`#selector` diagnostics from CSApply, and not attempt invalid disjunction choices
based on the selector kind on the valid code path.
This commit is contained in:
Holly Borla
2021-10-19 23:50:40 -07:00
parent 710c6b858b
commit beaaee7af1
2 changed files with 9 additions and 2 deletions

View File

@@ -3464,7 +3464,8 @@ namespace {
// Note that the subexpression of a #selector expression is
// unevaluated.
if (auto sel = dyn_cast<ObjCSelectorExpr>(expr)) {
CG.getConstraintSystem().UnevaluatedRootExprs.insert(sel->getSubExpr());
auto *subExpr = sel->getSubExpr()->getSemanticsProvidingExpr();
CG.getConstraintSystem().UnevaluatedRootExprs.insert(subExpr);
}
// Check an objc key-path expression, which fills in its semantic