@@ -3426,20 +3426,18 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
3426
3426
bool isSimple = T->hasSimpleTypeRepr ();
3427
3427
if (isSimple && T->is <OpaqueTypeArchetypeType>()) {
3428
3428
auto opaqueTy = T->castTo <OpaqueTypeArchetypeType>();
3429
- auto opaqueDecl = opaqueTy->getDecl ();
3430
- if (!opaqueDecl->hasName ()) {
3431
- switch (Options.OpaqueReturnTypePrinting ) {
3432
- case PrintOptions::OpaqueReturnTypePrintingMode::StableReference:
3433
- case PrintOptions::OpaqueReturnTypePrintingMode::Description:
3434
- isSimple = true ;
3435
- break ;
3436
- case PrintOptions::OpaqueReturnTypePrintingMode::WithOpaqueKeyword:
3437
- isSimple = false ;
3438
- break ;
3439
- case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword: {
3440
- isSimple = opaqueTy->getConformsTo ().size () < 2 ;
3441
- }
3442
- }
3429
+ switch (Options.OpaqueReturnTypePrinting ) {
3430
+ case PrintOptions::OpaqueReturnTypePrintingMode::StableReference:
3431
+ case PrintOptions::OpaqueReturnTypePrintingMode::Description:
3432
+ isSimple = true ;
3433
+ break ;
3434
+ case PrintOptions::OpaqueReturnTypePrintingMode::WithOpaqueKeyword:
3435
+ isSimple = false ;
3436
+ break ;
3437
+ case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword: {
3438
+ isSimple = opaqueTy->getExistentialType ()->hasSimpleTypeRepr ();
3439
+ break ;
3440
+ }
3443
3441
}
3444
3442
}
3445
3443
@@ -4221,14 +4219,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
4221
4219
Printer << " some " ;
4222
4220
LLVM_FALLTHROUGH;
4223
4221
case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword: {
4224
- SmallVector<Type, 2 > types;
4225
- for (auto proto : T->getConformsTo ())
4226
- types.push_back (proto->TypeDecl ::getDeclaredInterfaceType ());
4227
-
4228
- // Create and visit temporary ProtocolCompositionType.
4229
- auto composition =
4230
- ProtocolCompositionType::get (T->getASTContext (), types, false );
4231
- visit (composition);
4222
+ visit (T->getExistentialType ());
4232
4223
return ;
4233
4224
}
4234
4225
case PrintOptions::OpaqueReturnTypePrintingMode::StableReference: {
0 commit comments