File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -875,21 +875,23 @@ static void formatDiagnosticArgument(StringRef Modifier,
875875 }
876876
877877 if (includeName) {
878- // If it's an accessor, describe that and then switch to discussing its
879- // storage.
880878 if (auto accessor = dyn_cast<AccessorDecl>(D)) {
879+ // If it's an accessor, describe that and then switch to discussing its
880+ // storage declaration.
881881 Out << Decl::getDescriptiveKindName (D->getDescriptiveKind ()) << " for " ;
882882 D = accessor->getStorage ();
883+ } else if (auto ext = dyn_cast<ExtensionDecl>(D)) {
884+ // If it's an extension with a valid bound type declaration, describe
885+ // the extension itself then switch to discussing the bound
886+ // declaration.
887+ if (auto *nominal = ext->getSelfNominalTypeDecl ()) {
888+ Out << Decl::getDescriptiveKindName (D->getDescriptiveKind ())
889+ << " of " ;
890+ D = nominal;
891+ }
883892 }
884893 }
885894
886- // If it's an extension, describe that and then switch to discussing its
887- // nominal type.
888- if (auto ext = dyn_cast<ExtensionDecl>(D)) {
889- Out << Decl::getDescriptiveKindName (D->getDescriptiveKind ()) << " of " ;
890- D = ext->getSelfNominalTypeDecl ();
891- }
892-
893895 // Figure out the name we want to print.
894896 DeclName name;
895897 if (includeName) {
You can’t perform that action at this time.
0 commit comments