Skip to content

Commit 106357b

Browse files
authored
Merge pull request #37736 from xedin/adjacent-var-printing
[ConstraintSystem] NFC: Print out adjacent type variables to a debug log
2 parents 374e460 + 1673a9f commit 106357b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,9 @@ void BindingSet::dump(TypeVariableType *typeVar, llvm::raw_ostream &out,
15491549
}
15501550

15511551
void BindingSet::dump(llvm::raw_ostream &out, unsigned indent) const {
1552+
PrintOptions PO;
1553+
PO.PrintTypesForDebugging = true;
1554+
15521555
out.indent(indent);
15531556
if (isDirectHole())
15541557
out << "hole ";
@@ -1561,16 +1564,18 @@ void BindingSet::dump(llvm::raw_ostream &out, unsigned indent) const {
15611564
auto literalKind = getLiteralKind();
15621565
if (literalKind != LiteralBindingKind::None)
15631566
out << "literal=" << static_cast<int>(literalKind) << " ";
1564-
if (involvesTypeVariables())
1565-
out << "involves_type_vars ";
1567+
if (involvesTypeVariables()) {
1568+
out << "involves_type_vars=[";
1569+
interleave(AdjacentVars,
1570+
[&](const auto *typeVar) { out << typeVar->getString(PO); },
1571+
[&out]() { out << " "; });
1572+
out << "] ";
1573+
}
15661574

15671575
auto numDefaultable = getNumViableDefaultableBindings();
15681576
if (numDefaultable > 0)
15691577
out << "#defaultable_bindings=" << numDefaultable << " ";
15701578

1571-
PrintOptions PO;
1572-
PO.PrintTypesForDebugging = true;
1573-
15741579
auto printBinding = [&](const PotentialBinding &binding) {
15751580
auto type = binding.BindingType;
15761581
switch (binding.Kind) {

0 commit comments

Comments
 (0)