Skip to content

Commit 3a38d7a

Browse files
author
Amritpan Kaur
committed
[CSApply] Fixed type-checked subexpression output bug for multi-statement closures.
1 parent 9a0978a commit 3a38d7a

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

lib/Sema/CSApply.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8993,10 +8993,16 @@ ExprWalker::rewriteTarget(SolutionApplicationTarget target) {
89938993
result.setExpr(resultExpr);
89948994

89958995
if (cs.isDebugMode()) {
8996+
// If target is a multi-statement closure or
8997+
// a tap expression, expression will not be fully
8998+
// type checked until these types are visited in
8999+
// processDelayed().
89969000
auto &log = llvm::errs();
8997-
log << "---Type-checked expression---\n";
8998-
resultExpr->dump(log);
8999-
log << "\n";
9001+
if (!ClosuresToTypeCheck.empty() || !TapsToTypeCheck.empty()) {
9002+
log << "---Partially type-checked expression---\n";
9003+
resultExpr->dump(log);
9004+
log << "\n";
9005+
}
90009006
}
90019007
}
90029008

@@ -9057,6 +9063,13 @@ Optional<SolutionApplicationTarget> ConstraintSystem::applySolution(
90579063
return None;
90589064

90599065
rewriter.finalize();
9066+
9067+
if (isDebugMode()) {
9068+
auto &log = llvm::errs();
9069+
log << "---Fully type-checked expression---\n";
9070+
resultTarget->getAsExpr()->dump(log);
9071+
log << "\n";
9072+
}
90609073

90619074
return resultTarget;
90629075
}

0 commit comments

Comments
 (0)