Skip to content

[ConstraintSystem] Remove conjunction printing and iterate over all disjunction choices in scope #60762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions lib/Sema/CSStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,34 +356,38 @@ StepResult ComponentStep::take(bool prevFailed) {
});

auto *disjunction = CS.selectDisjunction();
auto *conjunction = CS.selectConjunction();

if (CS.isDebugMode()) {
PrintOptions PO;
PO.PrintTypesForDebugging = true;

auto &log = getDebugLogger();
if (!potentialBindings.empty()) {
auto &log = getDebugLogger();
log << "(Potential Binding(s): " << '\n';
log << potentialBindings;
}
log.indent(CS.solverState->getCurrentIndent());

if (disjunction) {
log.indent(2);
log << "Disjunction(s) = [";
SmallVector<Constraint *, 4> disjunctions;
CS.collectDisjunctions(disjunctions);
std::vector<std::string> overloadDisjunctions;
for (const auto &disjunction : disjunctions) {
PrintOptions PO;
PO.PrintTypesForDebugging = true;

auto constraints = disjunction->getNestedConstraints();
log << constraints[0]->getFirstType()->getString(PO);
log << "]";
if (constraints[0]->getKind() == ConstraintKind::BindOverload)
overloadDisjunctions.push_back(
constraints[0]->getFirstType()->getString(PO));
}
if (conjunction) {
if (!overloadDisjunctions.empty()) {
auto &log = getDebugLogger();
log.indent(2);
log << "Conjunction(s) = [";
auto constraints = conjunction->getNestedConstraints();
log << constraints[0]->getFirstType()->getString(PO);
log << "]";
log << "Disjunction(s) = [";
interleave(overloadDisjunctions, log, ", ");
log << "]\n";

if (!potentialBindings.empty() || !overloadDisjunctions.empty()) {
auto &log = getDebugLogger();
log << ")\n";
}
}
log << ")\n";
}

if (CS.shouldAttemptFixes()) {
Expand Down