1616#include " swift/AST/AccessScope.h"
1717#include " swift/AST/AvailabilityInference.h"
1818#include " swift/AST/ClangModuleLoader.h"
19+ #include " swift/AST/DiagnosticsSema.h"
1920#include " swift/AST/Expr.h"
2021#include " swift/AST/FileUnit.h"
2122#include " swift/AST/GenericEnvironment.h"
2526#include " swift/AST/ParseRequests.h"
2627#include " swift/AST/SourceFile.h"
2728#include " swift/AST/TypeCheckRequests.h"
29+ #include " swift/AST/TypeRepr.h"
2830#include " swift/AST/Types.h"
29- #include " swift/AST/DiagnosticsSema.h"
3031#include " swift/Basic/Assertions.h"
3132#include " swift/Basic/SourceManager.h"
3233#include " swift/Basic/Statistic.h"
@@ -802,10 +803,17 @@ unsigned DeclContext::printContext(raw_ostream &OS, const unsigned indent,
802803 OS << " name=" << cast<GenericTypeDecl>(this )->getName ();
803804 break ;
804805
805- case DeclContextKind::ExtensionDecl:
806- OS << " line=" << getLineNumber (cast<ExtensionDecl>(this ));
807- OS << " base=" << cast<ExtensionDecl>(this )->getExtendedType ();
806+ case DeclContextKind::ExtensionDecl: {
807+ auto *ED = cast<ExtensionDecl>(this );
808+ OS << " line=" << getLineNumber (ED);
809+ OS << " base=" ;
810+ if (ED->hasBeenBound ()) {
811+ OS << ED->getExtendedType ();
812+ } else {
813+ ED->getExtendedTypeRepr ()->print (OS);
814+ }
808815 break ;
816+ }
809817
810818 case DeclContextKind::TopLevelCodeDecl:
811819 OS << " line=" << getLineNumber (cast<TopLevelCodeDecl>(this ));
@@ -817,7 +825,12 @@ unsigned DeclContext::printContext(raw_ostream &OS, const unsigned indent,
817825
818826 case DeclContextKind::AbstractFunctionDecl: {
819827 auto *AFD = cast<AbstractFunctionDecl>(this );
820- OS << " name=" << AFD->getName ();
828+ OS << " name=" ;
829+ if (auto *AD = dyn_cast<AccessorDecl>(AFD)) {
830+ OS << accessorKindName (AD->getAccessorKind ());
831+ } else {
832+ OS << AFD->getName ();
833+ }
821834 if (AFD->hasInterfaceType ())
822835 OS << " : " << AFD->getInterfaceType ();
823836 else
0 commit comments