@@ -3398,20 +3398,18 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
3398
3398
bool isSimple = T->hasSimpleTypeRepr ();
3399
3399
if (isSimple && T->is <OpaqueTypeArchetypeType>()) {
3400
3400
auto opaqueTy = T->castTo <OpaqueTypeArchetypeType>();
3401
- auto opaqueDecl = opaqueTy->getDecl ();
3402
- if (!opaqueDecl->hasName ()) {
3403
- switch (Options.OpaqueReturnTypePrinting ) {
3404
- case PrintOptions::OpaqueReturnTypePrintingMode::StableReference:
3405
- case PrintOptions::OpaqueReturnTypePrintingMode::Description:
3406
- isSimple = true ;
3407
- break ;
3408
- case PrintOptions::OpaqueReturnTypePrintingMode::WithOpaqueKeyword:
3409
- isSimple = false ;
3410
- break ;
3411
- case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword: {
3412
- isSimple = opaqueTy->getConformsTo ().size () < 2 ;
3413
- }
3414
- }
3401
+ switch (Options.OpaqueReturnTypePrinting ) {
3402
+ case PrintOptions::OpaqueReturnTypePrintingMode::StableReference:
3403
+ case PrintOptions::OpaqueReturnTypePrintingMode::Description:
3404
+ isSimple = true ;
3405
+ break ;
3406
+ case PrintOptions::OpaqueReturnTypePrintingMode::WithOpaqueKeyword:
3407
+ isSimple = false ;
3408
+ break ;
3409
+ case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword: {
3410
+ isSimple = opaqueTy->getExistentialType ()->hasSimpleTypeRepr ();
3411
+ break ;
3412
+ }
3415
3413
}
3416
3414
}
3417
3415
@@ -4193,14 +4191,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
4193
4191
Printer << " some " ;
4194
4192
LLVM_FALLTHROUGH;
4195
4193
case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword: {
4196
- SmallVector<Type, 2 > types;
4197
- for (auto proto : T->getConformsTo ())
4198
- types.push_back (proto->TypeDecl ::getDeclaredInterfaceType ());
4199
-
4200
- // Create and visit temporary ProtocolCompositionType.
4201
- auto composition =
4202
- ProtocolCompositionType::get (T->getASTContext (), types, false );
4203
- visit (composition);
4194
+ visit (T->getExistentialType ());
4204
4195
return ;
4205
4196
}
4206
4197
case PrintOptions::OpaqueReturnTypePrintingMode::StableReference: {
0 commit comments