Skip to content

Commit 3ad8638

Browse files
author
Amritpan Kaur
committed
[CSApply] Fix type-checked subexpression output bug for multi-statement closures.
1 parent 38ddfe9 commit 3ad8638

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lib/Sema/CSApply.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8991,6 +8991,16 @@ ExprWalker::rewriteTarget(SolutionApplicationTarget target) {
89918991

89928992
solution.setExprTypes(resultExpr);
89938993
result.setExpr(resultExpr);
8994+
8995+
// Visit closures that have non-single expression bodies which
8996+
// could only be processed after contextual expression.
8997+
if (!ClosuresToTypeCheck.empty()) {
8998+
bool hadError = processDelayed();
8999+
9000+
// If any of them failed to type check, bail.
9001+
if (hadError)
9002+
return None;
9003+
}
89949004

89959005
if (cs.isDebugMode()) {
89969006
auto &log = llvm::errs();
@@ -9046,10 +9056,9 @@ Optional<SolutionApplicationTarget> ConstraintSystem::applySolution(
90469056
auto resultTarget = walker.rewriteTarget(target);
90479057
if (!resultTarget)
90489058
return None;
9049-
9050-
// Visit closures that have non-single expression bodies, tap expressions,
9051-
// and possibly other types of AST nodes which could only be processed
9052-
// after contextual expression.
9059+
9060+
// Visit tap expressions, and possibly other types of AST nodes which
9061+
// be processed after contextual expression.
90539062
bool hadError = walker.processDelayed();
90549063

90559064
// If any of them failed to type check, bail.

0 commit comments

Comments
 (0)