16
16
#include " swift/AST/AccessScope.h"
17
17
#include " swift/AST/AvailabilityInference.h"
18
18
#include " swift/AST/ClangModuleLoader.h"
19
+ #include " swift/AST/DiagnosticsSema.h"
19
20
#include " swift/AST/Expr.h"
20
21
#include " swift/AST/FileUnit.h"
21
22
#include " swift/AST/GenericEnvironment.h"
25
26
#include " swift/AST/ParseRequests.h"
26
27
#include " swift/AST/SourceFile.h"
27
28
#include " swift/AST/TypeCheckRequests.h"
29
+ #include " swift/AST/TypeRepr.h"
28
30
#include " swift/AST/Types.h"
29
- #include " swift/AST/DiagnosticsSema.h"
30
31
#include " swift/Basic/Assertions.h"
31
32
#include " swift/Basic/SourceManager.h"
32
33
#include " swift/Basic/Statistic.h"
@@ -802,10 +803,17 @@ unsigned DeclContext::printContext(raw_ostream &OS, const unsigned indent,
802
803
OS << " name=" << cast<GenericTypeDecl>(this )->getName ();
803
804
break ;
804
805
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
+ }
808
815
break ;
816
+ }
809
817
810
818
case DeclContextKind::TopLevelCodeDecl:
811
819
OS << " line=" << getLineNumber (cast<TopLevelCodeDecl>(this ));
@@ -817,7 +825,12 @@ unsigned DeclContext::printContext(raw_ostream &OS, const unsigned indent,
817
825
818
826
case DeclContextKind::AbstractFunctionDecl: {
819
827
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
+ }
821
834
if (AFD->hasInterfaceType ())
822
835
OS << " : " << AFD->getInterfaceType ();
823
836
else
0 commit comments