@@ -3412,20 +3412,18 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
3412
3412
bool isSimple = T->hasSimpleTypeRepr ();
3413
3413
if (isSimple && T->is <OpaqueTypeArchetypeType>()) {
3414
3414
auto opaqueTy = T->castTo <OpaqueTypeArchetypeType>();
3415
- auto opaqueDecl = opaqueTy->getDecl ();
3416
- if (!opaqueDecl->hasName ()) {
3417
- switch (Options.OpaqueReturnTypePrinting ) {
3418
- case PrintOptions::OpaqueReturnTypePrintingMode::StableReference:
3419
- case PrintOptions::OpaqueReturnTypePrintingMode::Description:
3420
- isSimple = true ;
3421
- break ;
3422
- case PrintOptions::OpaqueReturnTypePrintingMode::WithOpaqueKeyword:
3423
- isSimple = false ;
3424
- break ;
3425
- case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword: {
3426
- isSimple = opaqueTy->getConformsTo ().size () < 2 ;
3427
- }
3428
- }
3415
+ switch (Options.OpaqueReturnTypePrinting ) {
3416
+ case PrintOptions::OpaqueReturnTypePrintingMode::StableReference:
3417
+ case PrintOptions::OpaqueReturnTypePrintingMode::Description:
3418
+ isSimple = true ;
3419
+ break ;
3420
+ case PrintOptions::OpaqueReturnTypePrintingMode::WithOpaqueKeyword:
3421
+ isSimple = false ;
3422
+ break ;
3423
+ case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword: {
3424
+ isSimple = opaqueTy->getExistentialType ()->hasSimpleTypeRepr ();
3425
+ break ;
3426
+ }
3429
3427
}
3430
3428
}
3431
3429
@@ -4207,14 +4205,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
4207
4205
Printer << " some " ;
4208
4206
LLVM_FALLTHROUGH;
4209
4207
case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword: {
4210
- SmallVector<Type, 2 > types;
4211
- for (auto proto : T->getConformsTo ())
4212
- types.push_back (proto->TypeDecl ::getDeclaredInterfaceType ());
4213
-
4214
- // Create and visit temporary ProtocolCompositionType.
4215
- auto composition =
4216
- ProtocolCompositionType::get (T->getASTContext (), types, false );
4217
- visit (composition);
4208
+ visit (T->getExistentialType ());
4218
4209
return ;
4219
4210
}
4220
4211
case PrintOptions::OpaqueReturnTypePrintingMode::StableReference: {
0 commit comments