@@ -6445,34 +6445,45 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
64456445 }
64466446
64476447 void visitArraySliceType (ArraySliceType *T) {
6448- Printer << " [" ;
6449- visit (T->getBaseType ());
6450- Printer << " ]" ;
6448+ if (Options.AlwaysDesugarDictionaryTypes ) {
6449+ visit (T->getDesugaredType ());
6450+ } else {
6451+ Printer << " [" ;
6452+ visit (T->getBaseType ());
6453+ Printer << " ]" ;
6454+ }
64516455 }
64526456
64536457 void visitDictionaryType (DictionaryType *T) {
6454- Printer << " [" ;
6455- visit (T->getKeyType ());
6456- Printer << " : " ;
6457- visit (T->getValueType ());
6458- Printer << " ]" ;
6458+ if (Options.AlwaysDesugarDictionaryTypes ) {
6459+ visit (T->getDesugaredType ());
6460+ } else {
6461+ Printer << " [" ;
6462+ visit (T->getKeyType ());
6463+ Printer << " : " ;
6464+ visit (T->getValueType ());
6465+ Printer << " ]" ;
6466+ }
64596467 }
64606468
64616469 void visitOptionalType (OptionalType *T) {
64626470 auto printAsIUO = Options.PrintOptionalAsImplicitlyUnwrapped ;
6463-
6464- // Printing optionals with a trailing '!' applies only to
6465- // top-level optionals, not to any nested within.
6466- const_cast <PrintOptions &>(Options).PrintOptionalAsImplicitlyUnwrapped =
6467- false ;
6468- printWithParensIfNotSimple (T->getBaseType ());
6469- const_cast <PrintOptions &>(Options).PrintOptionalAsImplicitlyUnwrapped =
6470- printAsIUO;
6471-
6472- if (printAsIUO)
6473- Printer << " !" ;
6474- else
6475- Printer << " ?" ;
6471+ if (Options.AlwaysDesugarOptionalTypes ) {
6472+ visit (T->getDesugaredType ());
6473+ return ;
6474+ } else {
6475+ // Printing optionals with a trailing '!' applies only to
6476+ // top-level optionals, not to any nested within.
6477+ const_cast <PrintOptions &>(Options).PrintOptionalAsImplicitlyUnwrapped =
6478+ false ;
6479+ printWithParensIfNotSimple (T->getBaseType ());
6480+ const_cast <PrintOptions &>(Options).PrintOptionalAsImplicitlyUnwrapped =
6481+ printAsIUO;
6482+ if (printAsIUO)
6483+ Printer << " !" ;
6484+ else
6485+ Printer << " ?" ;
6486+ }
64766487 }
64776488
64786489 void visitVariadicSequenceType (VariadicSequenceType *T) {
0 commit comments