@@ -1376,6 +1376,26 @@ void AbstractionPattern::dump() const {
13761376 llvm::errs () << " \n " ;
13771377}
13781378
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+
13791399void AbstractionPattern::print (raw_ostream &out) const {
13801400 switch (getKind ()) {
13811401 case Kind::Invalid:
@@ -1396,9 +1416,7 @@ void AbstractionPattern::print(raw_ostream &out) const {
13961416 ? " AP::Type" :
13971417 getKind () == Kind::Discard
13981418 ? " AP::Discard" : " <<UNHANDLED CASE>>" );
1399- if (auto sig = getGenericSignature ()) {
1400- sig->print (out);
1401- }
1419+ printGenerics (out, *this );
14021420 out << ' (' ;
14031421 getType ().dump (out);
14041422 out << ' )' ;
@@ -1425,9 +1443,7 @@ void AbstractionPattern::print(raw_ostream &out) const {
14251443 getKind () == Kind::ObjCCompletionHandlerArgumentsType
14261444 ? " AP::ObjCCompletionHandlerArgumentsType("
14271445 : " AP::CFunctionAsMethodType(" );
1428- if (auto sig = getGenericSignature ()) {
1429- sig->print (out);
1430- }
1446+ printGenerics (out, *this );
14311447 getType ().dump (out);
14321448 out << " , " ;
14331449 // [TODO: Improve-Clang-type-printing]
@@ -1459,9 +1475,7 @@ void AbstractionPattern::print(raw_ostream &out) const {
14591475 getKind () == Kind::CurriedCXXMethodType
14601476 ? " AP::CurriedCXXMethodType("
14611477 : " AP::PartialCurriedCXXMethodType" );
1462- if (auto sig = getGenericSignature ()) {
1463- sig->print (out);
1464- }
1478+ printGenerics (out, *this );
14651479 getType ().dump (out);
14661480 out << " , " ;
14671481 getCXXMethod ()->dump ();
0 commit comments