Skip to content

Commit cc1a835

Browse files
author
Amritpan Kaur
committed
[CSBindings] Add potential bindings that are inferred from literals to type variable and binding printing.
1 parent 7024813 commit cc1a835

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ void BindingSet::dump(llvm::raw_ostream &out, unsigned indent) const {
17101710
}
17111711
case LiteralBindingKind::Float:
17121712
case LiteralBindingKind::None:
1713-
out << getLiteralBindingKind(literalKind).str();
1713+
out << getLiteralBindingKind(literalKind).str();
17141714
break;
17151715
}
17161716
if (attributes.empty()) {
@@ -1755,8 +1755,20 @@ void BindingSet::dump(llvm::raw_ostream &out, unsigned indent) const {
17551755

17561756
out << "[with possible bindings: ";
17571757
interleave(Bindings, printBinding, [&]() { out << "; "; });
1758-
if (Bindings.empty())
1758+
if (!Literals.empty()) {
1759+
std::vector<std::string> defaultLiterals;
1760+
for (const auto &literal : Literals) {
1761+
if (literal.second.viableAsBinding()) {
1762+
auto defaultWithType = "(default type of literal) " +
1763+
literal.second.getDefaultType().getString(PO);
1764+
defaultLiterals.push_back(defaultWithType);
1765+
}
1766+
}
1767+
interleave(defaultLiterals, out, ", ");
1768+
}
1769+
if (Bindings.empty() && Literals.empty()) {
17591770
out << "<empty>";
1771+
}
17601772
out << "]";
17611773

17621774
if (!Defaults.empty()) {

0 commit comments

Comments
 (0)