Skip to content

Commit b43086b

Browse files
author
Amritpan Kaur
committed
[ConstraintSystem] Convert collection literal kinds to string for printing.
1 parent 66e34b7 commit b43086b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,22 @@ static std::string getAtomLiteralAsString(ExprKind EK) {
16221622
#undef ENTRY
16231623
}
16241624

1625+
/// Return string for collection literal kinds (interpolated string, array,
1626+
/// dictionary) for printing in debug output.
1627+
static std::string getCollectionLiteralAsString(KnownProtocolKind KPK) {
1628+
#define ENTRY(Kind, String) \
1629+
case KnownProtocolKind::Kind: \
1630+
return String
1631+
switch (KPK) {
1632+
ENTRY(ExpressibleByDictionaryLiteral, "dictionary");
1633+
ENTRY(ExpressibleByArrayLiteral, "array");
1634+
ENTRY(ExpressibleByStringInterpolation, "interpolated string");
1635+
default:
1636+
return "";
1637+
}
1638+
#undef ENTRY
1639+
}
1640+
16251641
void BindingSet::dump(TypeVariableType *typeVar, llvm::raw_ostream &out,
16261642
unsigned indent) const {
16271643
out.indent(indent);

0 commit comments

Comments
 (0)