@@ -1376,6 +1376,26 @@ void AbstractionPattern::dump() const {
1376
1376
llvm::errs () << " \n " ;
1377
1377
}
1378
1378
1379
+ static void printGenerics (raw_ostream &out, const AbstractionPattern &pattern) {
1380
+ if (auto sig = pattern.getGenericSignature ()) {
1381
+ sig->print (out);
1382
+ }
1383
+ // It'd be really nice if we could get these interleaved with the types.
1384
+ if (auto subs = pattern.getGenericSubstitutions ()) {
1385
+ out << " @<" ;
1386
+ bool first = false ;
1387
+ for (auto sub : subs.getReplacementTypes ()) {
1388
+ if (!first) {
1389
+ out << " ," ;
1390
+ } else {
1391
+ first = true ;
1392
+ }
1393
+ out << sub;
1394
+ }
1395
+ out << " >" ;
1396
+ }
1397
+ }
1398
+
1379
1399
void AbstractionPattern::print (raw_ostream &out) const {
1380
1400
switch (getKind ()) {
1381
1401
case Kind::Invalid:
@@ -1396,9 +1416,7 @@ void AbstractionPattern::print(raw_ostream &out) const {
1396
1416
? " AP::Type" :
1397
1417
getKind () == Kind::Discard
1398
1418
? " AP::Discard" : " <<UNHANDLED CASE>>" );
1399
- if (auto sig = getGenericSignature ()) {
1400
- sig->print (out);
1401
- }
1419
+ printGenerics (out, *this );
1402
1420
out << ' (' ;
1403
1421
getType ().dump (out);
1404
1422
out << ' )' ;
@@ -1425,9 +1443,7 @@ void AbstractionPattern::print(raw_ostream &out) const {
1425
1443
getKind () == Kind::ObjCCompletionHandlerArgumentsType
1426
1444
? " AP::ObjCCompletionHandlerArgumentsType("
1427
1445
: " AP::CFunctionAsMethodType(" );
1428
- if (auto sig = getGenericSignature ()) {
1429
- sig->print (out);
1430
- }
1446
+ printGenerics (out, *this );
1431
1447
getType ().dump (out);
1432
1448
out << " , " ;
1433
1449
// [TODO: Improve-Clang-type-printing]
@@ -1459,9 +1475,7 @@ void AbstractionPattern::print(raw_ostream &out) const {
1459
1475
getKind () == Kind::CurriedCXXMethodType
1460
1476
? " AP::CurriedCXXMethodType("
1461
1477
: " AP::PartialCurriedCXXMethodType" );
1462
- if (auto sig = getGenericSignature ()) {
1463
- sig->print (out);
1464
- }
1478
+ printGenerics (out, *this );
1465
1479
getType ().dump (out);
1466
1480
out << " , " ;
1467
1481
getCXXMethod ()->dump ();
0 commit comments