@@ -1228,6 +1228,43 @@ TypeChecker::coerceToRValue(ASTContext &Context, Expr *expr,
12281228// ===----------------------------------------------------------------------===//
12291229#pragma mark Debugging
12301230
1231+ void OverloadChoice::dump (Type adjustedOpenedType, SourceManager *sm,
1232+ raw_ostream &out) const {
1233+ PrintOptions PO;
1234+ PO.PrintTypesForDebugging = true ;
1235+ out << " with " ;
1236+
1237+ switch (getKind ()) {
1238+ case OverloadChoiceKind::Decl:
1239+ case OverloadChoiceKind::DeclViaDynamic:
1240+ case OverloadChoiceKind::DeclViaBridge:
1241+ case OverloadChoiceKind::DeclViaUnwrappedOptional:
1242+ getDecl ()->dumpRef (out);
1243+ out << " as " ;
1244+ if (getBaseType ())
1245+ out << getBaseType ()->getString (PO) << " ." ;
1246+
1247+ out << getDecl ()->getBaseName () << " : "
1248+ << adjustedOpenedType->getString (PO);
1249+ break ;
1250+
1251+ case OverloadChoiceKind::KeyPathApplication:
1252+ out << " key path application root " << getBaseType ()->getString (PO);
1253+ break ;
1254+
1255+ case OverloadChoiceKind::DynamicMemberLookup:
1256+ case OverloadChoiceKind::KeyPathDynamicMemberLookup:
1257+ out << " dynamic member lookup root " << getBaseType ()->getString (PO)
1258+ << " name='" << getName ();
1259+ break ;
1260+
1261+ case OverloadChoiceKind::TupleIndex:
1262+ out << " tuple " << getBaseType ()->getString (PO) << " index "
1263+ << getTupleIndex ();
1264+ break ;
1265+ }
1266+ }
1267+
12311268void Solution::dump () const {
12321269 dump (llvm::errs ());
12331270}
@@ -1268,40 +1305,9 @@ void Solution::dump(raw_ostream &out) const {
12681305 out << " \n " ;
12691306 ovl.first ->dump (sm, out);
12701307 }
1271- out << " with " ;
12721308
12731309 auto choice = ovl.second .choice ;
1274- switch (choice.getKind ()) {
1275- case OverloadChoiceKind::Decl:
1276- case OverloadChoiceKind::DeclViaDynamic:
1277- case OverloadChoiceKind::DeclViaBridge:
1278- case OverloadChoiceKind::DeclViaUnwrappedOptional:
1279- choice.getDecl ()->dumpRef (out);
1280- out << " as " ;
1281- if (choice.getBaseType ())
1282- out << choice.getBaseType ()->getString (PO) << " ." ;
1283-
1284- out << choice.getDecl ()->getBaseName () << " : "
1285- << ovl.second .adjustedOpenedType ->getString (PO);
1286- break ;
1287-
1288- case OverloadChoiceKind::KeyPathApplication:
1289- out << " key path application root "
1290- << choice.getBaseType ()->getString (PO);
1291- break ;
1292-
1293- case OverloadChoiceKind::DynamicMemberLookup:
1294- case OverloadChoiceKind::KeyPathDynamicMemberLookup:
1295- out << " dynamic member lookup root "
1296- << choice.getBaseType ()->getString (PO)
1297- << " name='" << choice.getName ();
1298- break ;
1299-
1300- case OverloadChoiceKind::TupleIndex:
1301- out << " tuple " << choice.getBaseType ()->getString (PO) << " index "
1302- << choice.getTupleIndex ();
1303- break ;
1304- }
1310+ choice.dump (ovl.second .adjustedOpenedType , sm, out);
13051311 }
13061312 out << " \n " ;
13071313 }
0 commit comments