Skip to content

Commit 6dbaaa9

Browse files
author
Amritpan Kaur
committed
Fixed type-checked subexpression output bug for multi-statement closures.
1 parent e19ce5a commit 6dbaaa9

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

lib/Sema/CSApply.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8992,14 +8992,15 @@ ExprWalker::rewriteTarget(SolutionApplicationTarget target) {
89928992
solution.setExprTypes(resultExpr);
89938993
result.setExpr(resultExpr);
89948994

8995-
// Visit closures that have non-single expression bodies, tap expressions,
8996-
// and possibly other types of AST nodes which could only be processed
8997-
// after contextual expression.
8998-
bool hadError = processDelayed();
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();
89998999

9000-
// If any of them failed to type check, bail.
9001-
if (hadError)
9002-
return None;
9000+
// If any of them failed to type check, bail.
9001+
if (hadError)
9002+
return None;
9003+
}
90039004

90049005
if (cs.isDebugMode()) {
90059006
auto &log = llvm::errs();
@@ -9055,6 +9056,14 @@ Optional<SolutionApplicationTarget> ConstraintSystem::applySolution(
90559056
auto resultTarget = walker.rewriteTarget(target);
90569057
if (!resultTarget)
90579058
return None;
9059+
9060+
// Visit tap expressions, and possibly other types of AST nodes which
9061+
// be processed after contextual expression.
9062+
bool hadError = walker.processDelayed();
9063+
9064+
// If any of them failed to type check, bail.
9065+
if (hadError)
9066+
return None;
90589067

90599068
rewriter.finalize();
90609069

0 commit comments

Comments
 (0)