@@ -55,6 +55,24 @@ using namespace constraints;
5555
5656void TypeVariableType::Implementation::print (llvm::raw_ostream &OS) {
5757 getTypeVariable ()->print (OS, PrintOptions ());
58+
59+ SmallVector<TypeVariableOptions, 4 > bindingOptions;
60+ if (canBindToLValue ())
61+ bindingOptions.push_back (TypeVariableOptions::TVO_CanBindToLValue);
62+ if (canBindToInOut ())
63+ bindingOptions.push_back (TypeVariableOptions::TVO_CanBindToInOut);
64+ if (canBindToNoEscape ())
65+ bindingOptions.push_back (TypeVariableOptions::TVO_CanBindToNoEscape);
66+ if (canBindToHole ())
67+ bindingOptions.push_back (TypeVariableOptions::TVO_CanBindToHole);
68+ if (!bindingOptions.empty ()) {
69+ OS << " [allows bindings to: " ;
70+ interleave (bindingOptions, OS,
71+ [&](TypeVariableOptions option) {
72+ (OS << getTypeVariableOptions (option));},
73+ " , " );
74+ OS << " ]" ;
75+ }
5876}
5977
6078SavedTypeVariableBinding::SavedTypeVariableBinding (TypeVariableType *typeVar)
@@ -1415,24 +1433,7 @@ void ConstraintSystem::print(raw_ostream &out) const {
14151433 });
14161434 for (auto tv : typeVariables) {
14171435 out.indent (2 );
1418- Type (tv).print (out, PO);
1419- SmallVector<TypeVariableOptions, 4 > bindingOptions;
1420- if (tv->getImpl ().canBindToLValue ())
1421- bindingOptions.push_back (TypeVariableOptions::TVO_CanBindToLValue);
1422- if (tv->getImpl ().canBindToInOut ())
1423- bindingOptions.push_back (TypeVariableOptions::TVO_CanBindToInOut);
1424- if (tv->getImpl ().canBindToNoEscape ())
1425- bindingOptions.push_back (TypeVariableOptions::TVO_CanBindToNoEscape);
1426- if (tv->getImpl ().canBindToHole ())
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- }
1436+ tv->getImpl ().print (out);
14361437 auto rep = getRepresentative (tv);
14371438 if (rep == tv) {
14381439 if (auto fixed = getFixedType (tv)) {
0 commit comments