Skip to content

Commit 5430658

Browse files
author
Amritpan Kaur
committed
[TypeCheckConstraints] Reformat allowed binding properties.
1 parent ff2507b commit 5430658

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,14 +1416,23 @@ void ConstraintSystem::print(raw_ostream &out) const {
14161416
for (auto tv : typeVariables) {
14171417
out.indent(2);
14181418
Type(tv).print(out, PO);
1419+
SmallVector<TypeVariableOptions, 4> bindingOptions;
14191420
if (tv->getImpl().canBindToLValue())
1420-
out << " [lvalue allowed]";
1421+
bindingOptions.push_back(TypeVariableOptions::TVO_CanBindToLValue);
14211422
if (tv->getImpl().canBindToInOut())
1422-
out << " [inout allowed]";
1423+
bindingOptions.push_back(TypeVariableOptions::TVO_CanBindToInOut);
14231424
if (tv->getImpl().canBindToNoEscape())
1424-
out << " [noescape allowed]";
1425+
bindingOptions.push_back(TypeVariableOptions::TVO_CanBindToNoEscape);
14251426
if (tv->getImpl().canBindToHole())
1426-
out << " [hole allowed]";
1427+
bindingOptions.push_back(TypeVariableOptions::TVO_CanBindToHole);
1428+
if (!bindingOptions.empty()) {
1429+
out << " [allows bindings to: ";
1430+
interleave(bindingOptions, out,
1431+
[&](TypeVariableOptions option) {
1432+
(out << tv->getImpl().getTypeVariableOptions(option));},
1433+
", ");
1434+
out << "]";
1435+
}
14271436
auto rep = getRepresentative(tv);
14281437
if (rep == tv) {
14291438
if (auto fixed = getFixedType(tv)) {

0 commit comments

Comments
 (0)