[Function builders] Fake Expr-based locators for now.

The right solution is to extend the notion of the "anchor" of a locator
to also cover statements (and TypeReprs, and Patterns, and more), so
this is a stop-gap.
This commit is contained in:
Doug Gregor
2020-01-16 11:07:17 -08:00
parent cf96e6559a
commit bfa6d7316d
3 changed files with 28 additions and 5 deletions

View File

@@ -3653,13 +3653,14 @@ ConstraintSystem::getFunctionArgApplyInfo(ConstraintLocator *locator) {
assert(!shouldHaveDirectCalleeOverload(call) &&
"Should we have resolved a callee for this?");
rawFnType = getType(call->getFn());
} else {
} else if (auto *apply = dyn_cast<ApplyExpr>(anchor)) {
// FIXME: ArgumentMismatchFailure is currently used from CSDiag, meaning
// we can end up a BinaryExpr here with an unresolved callee. It should be
// possible to remove this once we've gotten rid of the old CSDiag logic
// and just assert that we have a CallExpr.
auto *apply = cast<ApplyExpr>(anchor);
rawFnType = getType(apply->getFn());
} else {
return None;
}
}