Skip to content

Commit 380ff81

Browse files
author
Amritpan Kaur
committed
changes 2
1 parent b48d9d2 commit 380ff81

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

lib/Sema/CSApply.cpp

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8151,6 +8151,11 @@ namespace {
81518151
// with already-type-checked expressions. Don't walk into them.
81528152
return false;
81538153
}
8154+
8155+
/// Check if there are any closures or tap expressions left to process.
8156+
bool shouldPrintFullyChecked() {
8157+
return ClosuresToTypeCheck.empty() && TapsToTypeCheck.empty();
8158+
}
81548159

81558160
/// Process delayed closure bodies and `Tap` expressions.
81568161
///
@@ -9079,36 +9084,16 @@ Optional<SolutionApplicationTarget> ConstraintSystem::applySolution(
90799084
if (hadError)
90809085
return None;
90819086

9082-
bool isPartial = false;
9083-
resultTarget->getAsExpr()->forEachChildExpr([&](Expr *child) -> Expr * {
9084-
if (auto *closure = dyn_cast<ClosureExpr>(child)) {
9085-
if (!closure->hasSingleExpressionBody()) {
9086-
isPartial = true;
9087-
return nullptr;
9088-
}
9089-
}
9090-
if (isa<TapExpr>(child)) {
9091-
isPartial = true;
9092-
return nullptr;
9093-
}
9094-
return child;
9095-
});
9096-
9097-
if (isPartial) {
9087+
// If there are no more closures or tap expressions to check,
9088+
// print expression.
9089+
if (walker.shouldPrintFullyChecked()) {
90989090
auto &log = llvm::errs();
90999091
log << "---Fully type-checked expression---\n";
91009092
resultTarget->getAsExpr()->dump(log);
91019093
log << "\n";
91029094
}
91039095

91049096
rewriter.finalize();
9105-
9106-
// if (isDebugMode()) {
9107-
// auto &log = llvm::errs();
9108-
// log << "---Fully type-checked expression---\n";
9109-
// resultTarget->getAsExpr()->dump(log);
9110-
// log << "\n";
9111-
//}
91129097

91139098
return resultTarget;
91149099
}

0 commit comments

Comments
 (0)