[Constraint solver] Fix backward trailing closures with ".member" expressions

The introduction of forward-scan matching for trailing closures
(SE-0286) failed to account for unresolved member expressions,
sometimes causing a crash in SILGen. Fixes rdar://problem/67781123.
This commit is contained in:
Doug Gregor
2020-08-31 11:18:27 -07:00
parent 6ad2757bef
commit 0b2b7b58e8
2 changed files with 22 additions and 1 deletions

View File

@@ -5592,7 +5592,9 @@ Expr *ExprRewriter::coerceCallArguments(
SmallVector<LocatorPathElt, 4> path;
auto anchor = locator.getLocatorParts(path);
if (!path.empty() && path.back().is<LocatorPathElt::ApplyArgument>() &&
(anchor.isExpr(ExprKind::Call) || anchor.isExpr(ExprKind::Subscript))) {
(anchor.isExpr(ExprKind::Call) ||
anchor.isExpr(ExprKind::Subscript) ||
anchor.isExpr(ExprKind::UnresolvedMember))) {
auto locatorPtr = cs.getConstraintLocator(locator);
assert(solution.trailingClosureMatchingChoices.count(locatorPtr) == 1);
trailingClosureMatching = solution.trailingClosureMatchingChoices.find(